[TriLUG] File rename utility

Paul D. Boyle boyle at laue.chem.ncsu.edu
Fri Jul 16 09:39:31 EDT 2004


Tarus Balrog wrote:
> I have a large archive of ... files, some of which contain special  
> characters in their names. While this seems to work fine on Linux and  
> OSX, I do have to make this collection of ... files available to  
> Windows users.
> 
> I need an easy way to:
> 
> A) find all files names with special characters (some sort of regex for  
> only A-Z, a-z, and 0-9 should do the trick)

The '-name' test of the find(1) command can take regular expressions.

For example, if you wanted to find a file with spaces in the name:
"a  008.dat"
(without the double quotes)), you could use this command:

find . -name "[a-z]*[ ]*[0-9]*" -print

The man page for find(1) also notes the '-regex' and '-iregex' switches
but I haven't had to use them.

> 
> B) have an automated way to rename the files, changing a ç to a c for  
> example.

I can't help you with this one.

Paul

-- 
Paul D. Boyle			    |	boyle at laue.chem.ncsu.edu
Director, X-ray Structural Facility |	phone: (919) 515-7362
Department of Chemistry - Box 8204  |	FAX:   (919) 515-8909
North Carolina State University     |	http://www.xray.ncsu.edu  
Raleigh, NC, 27695-8204



More information about the TriLUG mailing list