• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

bad characters in filenames

Hi, someone has created a lot of filenames with spaces in and others with backspace control characters.  How can I delete them ?  We have two boxes, one an HP and one a SCO, both with similar problems.
100 points for quick answer.

Thanks, Rich
0
Kyliem
Asked:
Kyliem
1 Solution
 
marecsCommented:
Try this

find . -name '*[^A-Za-z0-9._/~\-]*' -print  

If you are happy only files that you want to delete are being listed, then change that to

find . -name '*[^A-Za-z0-9._/~\-]*' -exec rm {} \;

Add any other allowable characters for a filename inbetween the square brackets, or remove some of them you don't like. The - has to be quoted.

0
 
OtetelisanuCommented:
Make
rm -i *
and you give y or n
0
 
prashant_n_mhatreCommented:
give filenames in quotes.

rm "filename"

also you can try out ./ before control character

rm ./filename
0
 
KyliemAuthor Commented:
Thanks, does the job just dandy.
0
 
KyliemAuthor Commented:
Ok, even It guys get it wrong sometimes.  The guy told me the answer was kosha before actually testing it himself.!

It seems all files are being listed using the command given
so can you revisit this for me.  I mainly need trap control char$ and spaces.  A specific example would be '|D[' where the first bar is possibly a pipe (it appears as a single thick bar in the emulation I have).

Cheers.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now