find: Strange File Names

1 
1 9.4 Strange File Names
1 ======================
1 
1 'find' can help you remove or rename a file with strange characters in
1 its name.  People are sometimes stymied by files whose names contain
1 characters such as spaces, tabs, control characters, or characters with
1 the high bit set.  The simplest way to remove such files is:
1 
1      rm -i SOME*PATTERN*THAT*MATCHES*THE*PROBLEM*FILE
1 
1    'rm' asks you whether to remove each file matching the given pattern.
1 If you are using an old shell, this approach might not work if the file
1 name contains a character with the high bit set; the shell may strip it
1 off.  A more reliable way is:
1 
1      find . -maxdepth 1 TESTS -okdir rm '{}' \;
1 
1 where TESTS uniquely identify the file.  The '-maxdepth 1' option
1 prevents 'find' from wasting time searching for the file in any
1 subdirectories; if there are no subdirectories, you may omit it.  A good
1 way to uniquely identify the problem file is to figure out its inode
1 number; use
1 
1      ls -i
1 
1    Suppose you have a file whose name contains control characters, and
1 you have found that its inode number is 12345.  This command prompts you
1 for whether to remove it:
1 
1      find . -maxdepth 1 -inum 12345 -okdir rm -f '{}' \;
1 
1    If you don't want to be asked, perhaps because the file name may
1 contain a strange character sequence that will mess up your screen when
1 printed, then use '-execdir' instead of '-okdir'.
1 
1    If you want to rename the file instead, you can use 'mv' instead of
1 'rm':
1 
1      find . -maxdepth 1 -inum 12345 -okdir mv '{}' NEW-FILE-NAME \;
1