How do I remove all files in a directory, but not sub-folders, or their contents in linux?

Posted by Yegor on Server Fault See other posts from Server Fault or by Yegor
Published on 2010-05-25T20:54:19Z Indexed on 2010/05/25 21:03 UTC
Read the original article Hit count: 283

Filed under:
|

I have a directly called /cache which has about a million files.

I restructured my caching system to put cache files into different folders, inside the /cache dir. new cache files are already being written to those sub-folders. So I want to remove all the files inside the /cache dir that are not in any subfolder.

How would I do this in SSH?

© Server Fault or respective owner

Related posts about linux

Related posts about file-removal