bash - What are some good ways to delete files with blank(invisible) names? -


i discovered files blank names in code repository, don't know how find them , delete them.

assuming have access find command,

find . -regex ".*\/[[:space:]][[:space:]]*" -exec rm {} \; 

if you'd check before deleting,

$ mkdir -p c/d # make empty filenames $ touch " " " b" "a b" $ touch "c/ " "c/ b" "c/a b" $ touch "c/d/ " $ touch "c/d/  " # echo filenames markings $ find . -regex ".*\/[[:space:]][[:space:]]*" -exec echo '{}<blank' \; ./ <blank ./c/ <blank ./c/d/ <blank ./c/d/  <blank 

note: surprise, works full-width spaces.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -