Link to home
Start Free TrialLog in
Avatar of PeterErhard
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?
Avatar of infochandru
infochandru
Flag of India image

Hope this wil help you

     rm -rf *
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tintin
Tintin

If you really want to be pedantic and *only* include files, then

find . -type f -maxdepth 1 | xargs rm
Avatar of PeterErhard

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?
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.