[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: removing files with unprintable characters in their filename

Mark T. Valites wrote:
Every once in a while, either a user somehow comes up with a file with
funky characters, or I create one by accident.  When displayed through a
'ls', the non-printable characters are displayed with "?"s.  The "?"s are
not literal question marks, but just represent an unprintable character.

Without using shell meta characters (*), C, perl, loops, find or anything
other than just the rm command, I haven't been able to figure out how to
remove this file.  There has to be a way to get rid of it with rm, but I
have had no such luck with it so far by quoting, escaping, using "--",
"./" or any other magic I can think of.

with a little help from man ls && man bash:

ls --escape will print the escape sequences for funky characters;

rm $'<pasted from ls --escape output>' will then work.

hope this helps!


Reply to: