Am 18.07.2011 10:48, schrieb Neil Bothwick: > On Sun, 17 Jul 2011 18:40:44 -0700, Grant wrote: > >> Alright, find is tricky. Is this the right spot for -delete? >> >> /usr/bin/find /home/user -type f -name "*-`/bin/date -d 'yesterday' >> +\%Y\%m\%d`*.jpg" - delete > > Yes, but if you don't want irreversible mistakes, move the files instead. > > find /home/user -type f -name blah -exec mv -t ~/.Trashcan "{}" + > >
In all these commands it would always be a good idea to deactivate parameter parsing just in front of the place where the file names are inserted. find ... -print0 | xargs -0 mv -t ~/.Trashcan -- or find ... -exec mv -t ~/.Trashcan -- "{}" + The double dash will prevent mv from interpreting weird file names like "-h" as parameters. Just about every standard GNU tool supports this. Regards, Florian Philipp
signature.asc
Description: OpenPGP digital signature