Thank you very much.
I have tried the above examples and can confirm they work perfectly.
This removed all files containing a ~ anywhere in the filename, in the current folder and all subfolders:
Quote:
find . -type f -name "*~*" | xargs rm -f
|
I can run this one as a shell script as it allows me to enter the folder path:
Quote:
find /base/dir/of/search -type f -name "*~" -print0 |xargs -0 rm -f
|
Combining the two I have:
Quote:
find /test/test_subfolder -type f -name "*~*" -print0 |xargs -0 rm -f
|
This is for cleaning up after a backup script. The script appends the date/time to the existing file, so backing up test.php gives:
-rw-r--r-- 1 root root 9 Dec 13 09:59 test.php
-rw-r--r-- 1 root root 4 Dec 13 09:50 test.php~2007-12-13_09:59
which leaves me with a valuable folder of all historical files in case of errors.