How do you recursively delete all hidden files in a directory on UNIX?

后端 未结 6 1618
谎友^
谎友^ 2021-02-01 03:42

I have been searching for a while, but can\'t seem to get a succinct solution. I have a Mac with a folder that I want to clean of all hidden files/directories - anything hidden.

6条回答
  •  Happy的楠姐
    2021-02-01 04:06

    rm -rf `find . -type f -regex '.*/\.+.+'`
    

    If you want to delete directories, change -type f for -type d.

    If you want to delete files and directories remove -type f

提交回复
热议问题