To remove the folder with all its contents(including all interior folders):
rm -rf /path/to/directory
To remove all the contents of the folder(including all interior folders) but not the folder itself:
rm -rf /path/to/directory/*
or if you want to make sure that hidden files/directories are also removed:
rm -rf /path/to/directory/{*,.*}
To remove all the “files” from inside a folder(not removing interior folders):
rm -f /path/to/directory/{*,.*}
If a folder contains to many files (~over 30 000) rm can not delete then and display error:
bash: /bin/rm: Argument list too long
One solution is to use “find”, and for each result of find rum command “rm”:
find . -name "*.log" -print | xargs rm
rsync -a --delete empty/ sessioncache/