[NTLUG:Discuss] How do I make all files in a directory of zero length?
George E. Lass
George.Lass at osc.com
Wed Jun 6 11:49:13 CDT 2001
Try this:
create a file called cmd in the directory that you want to
cleanup. Here is what goes into the file called cmd:
#!/bin/bash
for FILE in *
do
if [ -f $FILE -a $FILE != cmd ]
then
> $FILE
fi
done
Then do: chmod 777 cmd
./cmd
You must have write permission on all files
George
Lance Simmons wrote:
>
> I want to go into a directory and make all the files of zero
> length. What's the easiest way to do this?
>
> Do I need to save the filenames, delete the files, and then
> touch the saved filenames?
>
> Is there a more direct way to achieve the result I'm looking for?
>
> --
> .~.
> /v\ Lance Simmons
> // \\ lance at lsimmons.net
> /( )\
> __^_^________________________________________________________________________
> Science can purify religion from error and superstition. Religion can purify
> science from idolatry and false absolutes.
> -- Karol Wojtyla
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list