[NTLUG:Discuss] How do I make all files in a directory of zerolength?

R. Jay Campbell chezjc at home.com
Wed Jun 6 22:32:16 CDT 2001


"A.L.Lambert" 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?
> 
> cd /path/dir/ ; for i in * ; do echo -n > $i ; done
> 

How about

cd /path/dir/ ; for i in * ; do :> $i ; done


-- 
R. Jay Campbell
mailto:chezjc at home.com
"Imagine there's no heaven,
it's easy if you try..."



More information about the Discuss mailing list