Finding multiple files with ascending numerical files extensions
Greetings all,
I've recently been tasked with writing a smart script that can grab binlog files from MySQL, tar/gzip them and then be able to recognize which files it has already grabbed and then move onto the next chunk of log files. For instance, #ls -al file.001 file.002 file.003 file.004 file.inded file.005 file.006 etc I need to be able to find/locate files 00x through 00x, and leaving out any 00x file that isn't listed in my parameters. Thus far I haven't found a way to do this using Find. Any suggestions? |
Hi,
You can use regular expressions when using find: find . -type f -iname "file.00[0-5]" should give back file.000 - file.005 (if they actually exist). Hope this helps. |
Thanks! That solved my issue.
|
In the long run you'd probably be better off using the logrotate facility for that kind of work.
|
All times are GMT -5. The time now is 08:40 PM. |