Finding empty directories UNIX

后端 未结 12 635
心在旅途
心在旅途 2020-12-07 14:11

I need to find empty directories for a given list of directories. Some directories have directories inside it.

If inside directories are also empty I can say main di

12条回答
  •  半阙折子戏
    2020-12-07 14:29

    find . -type d -empty

    finds and lists empty directories and sub-directories in the current tree. E.g. resulting list of empty dirs and subdirs:

    ./2047
    ./2032
    ./2049
    ./2063
    ./NRCP26LUCcct1/2039
    ./NRCP26LUCcct1/2054
    ./NRCP26LUCcct1/2075
    ./NRCP26LUCcct1/2070
    

    No operation is made on the directories. They are simply listed. This works for me.

提交回复
热议问题