Linux - Delete the contents of a directory

March 2017




Issue


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

Solution


You put yourself in the directory and do

rm -rf *  


Or you do

rm -rf your_directory/*  

Note


Solved by cricx

Related


Published 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 (ccm.net).