1
vote
2answers
186 views

find: how to not have errors (stderr) when no files exists

I have a custom script which gzip log files when they are one day old. In my script all errors (stderr) are logged to a file and at the end of the script I use this file to know if its execution was ...
0
votes
4answers
273 views

Calculate disk space occupied by many .png files

I have 357 .png files located in different sub dirs of the current dir: settings# find . -name \*.png |wc -l 357 settings# find . -name \*.png | head ./assets/authenticationIcons/audio.png ...
2
votes
2answers
60 views

How do I detect the version of find on OSX

I need to detect which version of the find command is used from a shell script. GNU find supports the --version argument but the find command on OSX apparently does not support that. Is there a way to ...
0
votes
2answers
419 views

How to find .h,.c and .cc files under current directory in linux?

find . -name "*.[hc]|*.cc" The above doesn't work,why? UPDATE How do I find these 3 kinds of files with a single pattern?
2
votes
4answers
791 views

How to bulk rename files to remove an extraneous space from before the extension

I have a bunch of files who's filename follows the pattern 'filename.ext'. eg: filename .ext I would like to rename all of these to remove the space before the .ext. eg: filename.ext I can find ...
3
votes
3answers
709 views

sh script to remove just txt files using find and exec rm warns me of missing argument to exec

find /full/path/dir -name '*.txt' -exec /bin/rm {} \; Fine in a shell, but pop it in a sh script along with some similar lines, to get it to run nightly from a cronjob, and it reports: find: ...
6
votes
2answers
3k views

find command default sorting order

what is the default sorting order for entries returned by the linux find command? For example, if I issue find . -type f -name '*mp3' and the output consists of multiple files across multiple ...
1
vote
2answers
551 views

Linux shell script: delete all files without “01” in the name

I have a backup script that creates files named for the day of creation in the format backups_YYYYMMDD.tar.gz I currently purge everything over 30 days old with a command like this: find /backups ...
9
votes
7answers
13k views

Linux: using find to locate files older than <date>

find has good support for finding files the more modified less than X days ago, but how can I use find to locate all files modified after a certain date? I can't find anything in the find man page to ...
9
votes
3answers
176 views

Find's -true option: what for?

GNU find (and others?) has a -true test along with the normal -name, -mode, -user and so on. From the man page: -true Always true. Every time I see the man page I notice this and wonder when ...