[techtalk] Removing spaces form Windows File names

Jeff Dike jdike at karaya.com
Wed May 31 18:51:48 EST 2000


karina.hould at autodesk.com said:
> Is there a file I can create that will do this? I am not a programmer,
> so I have limited knowledge in creating files but I can sure try...

> Any help you could provide would be amazing. 

I don't think I could pass up a chance to be amazing :-)

find /dos -name "* *" -exec sh -c 'echo {} | (read f ; mv "$f" `echo $f | sed 
"s/ //g"`)' \;

ought to do the trick, assuming all those files are under /dos.  It does give 
me a find error on one file in my test directory, but the move happened.  It 
was also harder than I expected.

However, I don't think you should do this without explaining why you think you 
need to.  Did some window-y thing dump a bunch of spacey filenames into your 
Linux filesystem or are you trying to change all the spacey filenames on a 
windows filesystem?

				Jeff







More information about the Techtalk mailing list