PeterErhard
asked on
delete all files in current directory
Is a command you can issue that will delete every file in the current directory only?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you really want to be pedantic and *only* include files, then
find . -type f -maxdepth 1 | xargs rm
find . -type f -maxdepth 1 | xargs rm
ASKER
Thanks guys.
So, just to confirm:
If I'm in the "/home /admin /_processed_stats" directory and run rm -f * it will only delete the files within that directory and nothing else?
So, just to confirm:
If I'm in the "/home /admin /_processed_stats" directory and run rm -f * it will only delete the files within that directory and nothing else?
Yep!
For goodness sakes be careful with spaces when using rm -f ;)
rm -rf /usr/local /bin
for example will remove /usr/local AND /bin ;) not /usr/local/bin ;)
and Tintin's solution is the best, because it won't remove directories, just files.
rm -rf /usr/local /bin
for example will remove /usr/local AND /bin ;) not /usr/local/bin ;)
and Tintin's solution is the best, because it won't remove directories, just files.
rm -rf *