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

后端 未结 6 1601
谎友^
谎友^ 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条回答
  •  渐次进展
    2021-02-01 04:19

    You need to be very careful and test any commands you use since you probably don't want to delete the current directory (.), the parent directory (..) or all files.

    This should include only files and directories that begin with a dot and exclude . and ...

    find . -mindepth 1 -name '.*' -delete
    

提交回复
热议问题