Solved

bad characters in filenames

Posted on 2001-06-16
5
265 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now