Linked Questions
12 questions linked to/from How to remove all empty directories in a subtree?
316
votes
2
answers
286k
views
how can I recursively delete empty directories in my home directory? [duplicate]
Possible Duplicate:
How to remove all empty directories in a subtree?
I create directories very often, scattered over my home directory, and I find it very hard to locate and delete them.
I want ...
3
votes
3
answers
4k
views
Recursively cleanup all folders and sub-folders in a folder that have no files in them [duplicate]
I've got a folder with a load of folders in folders in folders etc... Some of the folders have files, and some do not. I want to cleanup the main folder by finding all directories with no files and ...
0
votes
1
answer
2k
views
Delete Empty Folders - recursive [duplicate]
I would like to clean up some folders. So I want to delete all folders which are empty or only contain other folders...
First I tried
find . -type d -delete
but this lists the subfolders after the ...
18
votes
6
answers
12k
views
Remove empty directory trees (removing as many directories as possible but no files)
Suppose I have a dir tree like this:
ROOTDIR
└--SUBDIR1
└----SUBDIR2
└----SUBDIR3
I am looking for a command such that when I input:
$ [unknown command] ROOTDIR
The whole dir ...
10
votes
4
answers
766
views
How to extract a specifically named folder from a recursive directory, delete the others?
I have this kind of directory tree that is obtained from unzipping a zip file:
x -> y -> z -> run -> FILES AND DIRECTORIES HERE
So there are 4 directories, 3 of whom are empty of files (x, y, z) and ...
6
votes
7
answers
1k
views
List folders which contain only a subfolder named Attic
I'm cleaning up a CVS repo before migration to git. As part of the preparation I need to find (and possibly remove) any folders which ONLY contain an Attic folder.
My unix-fu is not strong, but here'...
8
votes
4
answers
8k
views
use 'find' to search for directories !containing certain filetype foo
I have a few directories, some with a depth of 3, which contain mixed file types. What I need to do is to rm -rf all the subdirectories that do not contain filetype foo.
Is this achievable with find ...
10
votes
2
answers
5k
views
Finding empty directories recursively
How can I find every empty directory, let's say, on the /home/.../Desktop. Because I am on Solaris, I can't use the find . -empty -type d command. Is there any other way?
7
votes
2
answers
9k
views
Find empty directoris OR directories with no files in them recursively
There's the find . -type d -empty command, but that only finds literally empty directories.
What I want to achieve is something a little bit more complex: I want to find empty directories or ...
7
votes
2
answers
5k
views
Command that deletes all old files, folders and sub-folders
I need a command that deletes all files, folders and sub-folders that were not updated longer than 31 days.
I tried this one
find . -mindepth 1 -mtime +31 -exec rm -rf "{}" \;
But if I have ...
1
vote
2
answers
586
views
Recursively delete empty directories with a dotfile / directory exclusion?
How do I recursively delete all directories which do not contain any files and make an exclusion of hidden directories?
A lot of the directories that I wish to delete contain hidden directories (dot ...
0
votes
1
answer
182
views
Sync two directories: same filename, different fileending, different filecontent
I have 2 folders with subdirectories. One with training images and one with training labels.
One image belongs to exactly one label
The image and the label have different content
The image and the ...