[Technic] linux help
Scott Mayo
sgmayo at mail.bloomfield.k12.mo.us
Thu Jul 12 10:09:26 CDT 2007
Ricky Nance wrote:
> The way I ran it here at home was rm `ls | grep -v save` -fdr and it worked...
> the ls * shows the files under save1, save2, etc.
>
When I did an 'ls | grep -v keep', then it did not list the actually
directory, but it did list the files in it. Since it listed the files,
I figured that the above command would have kept the save directory, but
would have deleted the files. I'll try it since you said it worked.
I ended up doing a find and that worked also, so I guess I am happy.
find . -maxdepth 1 | grep -v keep | xargs rm -r
So it found everything on the main directory except for anything in the
keep directory and then passed that to the rm which did a recursive
delete on the directory that it was passed.
--
Scott Mayo
System Administrator
Bloomfield Schools
PH: 573-568-5669
FA: 573-568-4565
Pager: 800-264-2535 X2549
Duct tape is like the force, it has a light side and a dark side and it
holds the universe together.
More information about the Technic
mailing list
|