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

crash - Windows Rundll32 (child process of DllHost) is crashing. How can I even identify it? - Super User

debian - Kali Linux - Debootstrap error Failed to determine codename for the release - Super User

networking - Slave steals IP meant for bonded interface - Ask Ubuntu