Tuesday, January 13, 2015

Linux - Search for empty directories and files

To search for empty directories type:
$ find . -empty -type d
To delete empty directories:
$ find . -empty -type d -delete

If enter -type f instead of -type d, this command will search for empty files:
$ find . -empty -type f
to delete empty files:
$ find . -empty -type f -delete

No comments:

Post a Comment