[oclug] find help
James Lockie
bjlockie at lockie.ca
Tue Jan 29 09:19:59 EST 2008
Woogie wrote:
> I shudder to think why you're making a script to do this, but I'll
> work on the premise the reason isn't malicious.
>
I want to empty all my email at home.
I keep it all at work but I only need the recent stuff when I work from
home.
I have alot of filters/folders and I don't see an easy way to empty them
all.
> Try rearranging your quotes so that the argument to echo is properly
> escaped instead of the whole command, and give echo a null character
> (pair of single quotes), like so:
> find . -name \* -type f -exec echo '' > "{}" \;
>
>
> Note, that I have not tested this. If that doesn't work, there is
> another alternative:
>
> find . -name \* -type f -exec rm "{}" && touch "{}" \;
>
> I haven't tested that either. Also, that one might not work for you
> because any special permissions or ownerships will get replaced. Also,
> I think the "&&" might not function correctly inside that -exec block
> either.
>
> On Jan 20, 2008 2:23 PM, James Lockie <bjlockie at lockie.ca> wrote:
>
>> I want to make all files 0 bytes.
>> I tried this:
>> find . -name \* -type f -exec "echo > {}" \;
>>
>> This shows the correct file listing:
>> find . -name \* -type f -exec "ls -l {}" \;
More information about the OCLUG
mailing list