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
Post a Comment