Remove all files in a directory (do not touch any folders or anything within them)
bash, linux, shell, unix
Solution
Although find allows you to delete files using `-exec rm {} \;` you can use
find /direcname -maxdepth 1 -type f -delete
and it is faster. Using -delete implies the -depth option, which means process directory contents before directory.
Problem
I would like to know whether `rm` can remove all files within a directory (but not the subfolders or files within the subfolders)? I know some people use: ``` rm -f /direcname/*.* ``` but this assumes the filename has an extension which not all do (I want all files - with or without an extension to be removed).