>>> 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.

Does that apply to a command like this:

/usr/bin/find /home/user -type f -name "*-`/bin/date -d 'yesterday'
+\%Y\%m\%d`*.jpg" -delete

Maybe it should be changed to this:

/usr/bin/find /home/user -type f -name -- "*-`/bin/date -d 'yesterday'
+\%Y\%m\%d`*.jpg" -delete

- Grant

Reply via email to