deleting files recursively, but not directories
Hi,
I'm dealing with this kind of problem. I have a tree of many directories and subdirectories, and I wanto to make a script that delete all files existing in this tree, but not directories, so I can have my tree empty. The problem is that if I use " rm -rf * " , the command deletes also directories, because with " -r * " it deletes also directories if empty, not only files. Does anybody have a tip? Thanks in advance |
hello
"find" can delete only files in a directory tree, (better check result or can delete something important!): Code:
find dir -type f -print0 | xargs -0 ls -l Code:
find dir -type f -print0 | xargs -0 rm |
Wonderful!!!
it was so simple... Thanks a lot! |
All times are GMT -5. The time now is 08:15 AM. |