How to delete all contents of a folder.
There are times when you need to completely delete the contents of a folder while leaving the folder itself.
For example, you need to clear the temporary directory , that is, tmp just run the following command:
rm -R /tmp/*
Check if the folder has been cleared with the command:
Either you need to recursively delete files of the same type.
For example, in the folder with ODF and TXT files, you need to delete all TXT files without affecting ODF.
It's not very convenient to do this in file managers, but here the console saves us because we don't have to search for the files we need by extension, but just execute the following command:
rm -R path to the folder * .txt
rm -R /home/max/1/*.txt
Or any other file extension to be removed.