Tag: command

Remove empty directories recursively

Remove empty directories recursively

Use find command

Use following command can remove empty directories which may have empty directories in them. The -depth will sort the output according to the depth of directories.

find . -type d -depth -exec rmdir {} \;

Note: Just ignore error due to directory not empty

Use rmdir command

First, need to know how deep of your directory, then can run following command

rmdir */*/*/*
rmdir */*/*
rmdir */*
rmdir *

Note: This can cause too many arguments error or command line too long error for large directory.