Yes:
rm -rf *
Be carefull where you are when you run this it will delete everything from the current directory and all subdirectories.
If you only want to delete files, and no directories use:
rm *
As @DanielAndersson very correctly pointed out in the comments, this will not delete hidden files and directories (those beginning with a .
). To delete those as well do
rm -rf * .*
This will give an error about not being able to delete .
and ..
(the current and parent directories respectively). You can safely ignore that, rm
will never delete these since they are protected by the POSIX standard (see here and here). If you don't want to see the error message you can specify that you only want to delete those dotfiles and folders whose .
is followed by a non .
character:
rm -rf * .[^.]*
Finally, if you want to delete all files in the current directory and all subdirectories but keep the directories, do this:
find . -type f -delete
2
man
is your friend. – Kale Muscarella – 2013-09-06T17:53:02.213I tried this before posting -- couldn't figure it out. – Dave Melia – 2013-09-06T17:54:43.000
rm filename* or rm | grep filename – Everett – 2013-09-20T21:17:21.993