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

Windows XP installation, no previous version of Windows NT - Super User

permissions - Mount is denied because the NTFS volume is already exclusively opened - Ask Ubuntu

software installation - How to install linux driver for a lb-link wireless usb adapter - Ask Ubuntu