LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Finding multiple files with ascending numerical files extensions (https://www.linuxquestions.org/questions/linux-newbie-8/finding-multiple-files-with-ascending-numerical-files-extensions-721183/)

unim21 04-23-2009 10:58 AM

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?

druuna 04-23-2009 11:05 AM

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.

unim21 04-23-2009 12:25 PM

Thanks! That solved my issue.

chrism01 04-23-2009 07:50 PM

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 09:23 AM.