You are not logged in.

#1 2008-04-14 20:06:44

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Bash script to trim all filenames with special characters recursively?

Hi,

I have a 30 GB directory full of data I recovered from a friend's laptop after her Windows XP crashed. I'd like to burn that data, but I can't, because many of the filenames contain weird characters (spaces, accents, things even worse that my XTerm displays as inverted question marks). So, mkisofs exits with an error.

I'd like to clean that mess up, but it would take months to do that manually. Well, I only know a very little Bash, but I think this problem is already too heavy for my modest knowledge. Here's the problem:

- check the contents of directory ~/backup recursively
- find files whose filenames contain characters other than [A-Za-z0-9] and then maybe "-" and "_" and ".".
- replace these characters either by an "_" or just erase them

Now how would I translate that into a little Bash script?

Cheers...


Dyslexics have more fnu.

Offline

#2 2008-04-14 22:22:56

tam1138
Member
Registered: 2007-09-10
Posts: 238

Re: Bash script to trim all filenames with special characters recursively?

Zip it and burn it; you won't lose anything.

Offline

#3 2008-04-15 04:38:00

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Re: Bash script to trim all filenames with special characters recursively?

Heyyyyy... nice idea smile


Dyslexics have more fnu.

Offline

Board footer

Powered by FluxBB