Solved

bad characters in filenames

Posted on 2001-06-16
5
268 Views
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
0
Comment
Question by:Kyliem
5 Comments
 
LVL 5

Accepted Solution

by:
marecs earned 100 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.

0
 
LVL 4

Expert Comment

by:Otetelisanu
ID: 6198812
Make
rm -i *
and you give y or n
0
 
LVL 4

Expert Comment

by:prashant_n_mhatre
ID: 6199172
give filenames in quotes.

rm "filename"

also you can try out ./ before control character

rm ./filename
0
 

Author Comment

by:Kyliem
ID: 6201926
Thanks, does the job just dandy.
0
 

Author Comment

by:Kyliem
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).

Cheers.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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.

828 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