[oclug] find help
Woogie
woogie at gmail.com
Sun Jan 20 14:50:58 EST 2008
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.
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 {}" \;
>
> --
> OCLUG general discussion list
> OCLUG at lists.oclug.on.ca
> http://oclug.on.ca/mailman/listinfo/oclug
>
--
Evil will always triumph, because good is dumb
More information about the OCLUG
mailing list