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