Improve company productivity with a Business Account.Sign Up

x
?
Solved

bad characters in filenames

Posted on 2001-06-16
5
Medium Priority
?
279 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 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.

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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.:
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…

595 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