bad characters in filenames

Posted on 2001-06-16
Medium Priority
Last Modified: 2010-04-21
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
Question by:Kyliem
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

marecs earned 300 total points
ID: 6198150
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.


Expert Comment

ID: 6198812
rm -i *
and you give y or n

Expert Comment

ID: 6199172
give filenames in quotes.

rm "filename"

also you can try out ./ before control character

rm ./filename

Author Comment

ID: 6201926
Thanks, does the job just dandy.

Author Comment

ID: 6202087
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).


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question