Back to the Stone Age
Although the date is something like 21st century, Windows still enforce ridiculous restrictions on file and directory names. Namely, they cannot contain the following characters: \ / : * ? " < > |. Now, imagine you have a large directory tree containing 3200+ files which are “badly named” according to these rules. The tree was created in Linux but now you need to use it in Windows as well.
I have been facing this problem since Apple kindly decided to completely change the music storage format on iPod/iPhone. Now I have to use iTunes (eek) to sync the music, and I need to open my music collection in Windows. I have it nicely organized by tags, which sometimes contain colons, question marks, or quote marks.
The solution is a short Bash script. You just give it a path where it should start. The script will then recursively search it and replace all troublesome characters with dashes. For instance:
$ ./backToTheStoneAge.sh ~/Media/Music
It’s so great that the super-modern NTFS can handle Unicode. I guess that next time I will be struggling with naming files according to the 8.3 convention. Sigh.
Download: backToTheStoneAge.sh (1.2kB)
Speak your mind
Allowed HTML tags are a, blockquote, em, code, li, ol, p, pre, strong, ul. Links to other comments in the form “[IV]” or “[4]” are detected automatically.