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

后端 未结 6 1506
谎友^
谎友^ 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:15

    find /path -iname ".*" -type f -delete ;
    

    Ruby(1.9+)

    ruby -rfileutils -e 'Dir["**/.*"].each{|x| FileUtils.rm(x) if File.file?(x)}'
    

提交回复
热议问题