to delete files on under folder we can use the following approach with find
find /home -type f -delete
but how to delete recursive only the files that exists under temp folder ?
lets say we have the following example of temp path
/home/bla/bla/temp
/home/test/temp
/home/subf/subf/subf/temp
.
.
.
/home/1/temp
how to change the find syntax in order to delete only the files under temp
directory
the target is to use find command in order to match only the temp folders and remove the files under temp directory
temp
, but not the directory itself? Please confirm.-type f
in your example matches regular files, but you keep saying "files". This is a broad term. Do you really mean (all) files? or regular files? Removing regular files only will leave directories, symlinks, sockets and such intact. Please edit the question and clarify.