Linux - Delete the contents of a directory

September 2017


I'm under linux and I cannot find the command to erase the contents of a folder without deleting the file read itself. So if someone could help me with this command Thanks! Rm-r deletes the folder too. So it's not the one I want. Thank you


You put yourself in the directory and do

rm -rf *  

Or you do

rm -rf your_directory/*  


Solved by cricx


Published by aakai1056. Latest update on April 5, 2012 at 08:23 AM by aakai1056.
This document, titled "Linux - Delete the contents of a directory," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (