command line - Delete files within all directories in a directory - Ask Ubuntu


i needed delete files within ~40 directories within parent directory, without deleting directories themselves. ended manually doing so, there more efficient way of doing this? i.e., there linux command can this?

for more clear picture of mean:

homedirectoryname --> subdirectoryname --> 4 simulation info files

i had above path, except there 40 subdirectories, each of have 4 simulation files. needed delete simulation info files without deleting "subdirectoryname" directories.

it may not possible, searched everywhere hour before deciding manually.

it's simple find command - use -type f find files , not directories

find /path/to/parent/directory -type f -delete 

by default, find recurses subdirectories, find files in tree point down.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User