I need to delete all the content of a folder in CentOS but not the folder itself.
For example: I have a folder named "MYFOLDER" which contains subfolders FOLD_1, FOLD_2, FOLD_3, FOLD_4… etc , and some files. I need to delete all these folders and files but not the container folder MYFOLDER. I need this directory to direct the results of a previous process.
I tried with the rm -rf
command, but this delete the container folder too.
Best Answer
Delete the contents of the folder instead.