(To view this text file, please use Word Wrap)


If you've ever burned a lot of MP3s or other files to CD, you might find that the names get cut off. Here's a handy-dandy script that, on a Windows machine, trims the name to 64 characters, so it'll fit on a CD without problems, then includes a batch file in each directory that expands the name back to full after you put them back onto a hard drive...
 
Very useful, if you're me, or someone like me.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

What's included:

o=> 64 Char Trim (Recursive).bat
This does the trimming. It trims all files in the current directory, and all subdirectories, to 64 characters (including the extension, which is included in full)

o=> Delete all batch files (recursive - includes this).bat
This is a good one to have after you de-compress the filenames. It deletes all .bat files
in the current directory and all subdirectories.

o=> del-bat.vbs
Script file for "Delete" above

o=> trim2.vbs
Script file for "Trim" above

o=> readme.txt
This file. Duh.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Use:

Drop the files "trim2.vbs" and "64 Char Trim (Recursive).bat" into the rootmost directory* of files you wish to change. Then run "64 Char Trim (Recursive).bat". It will change the filenames as necessary, and generate a file called "restore-all.bat" in that directory, and "restore-me.bat" in directories with long-named files. To restore all of the file names, in all subdirectories, at once, run restore-all.bat. To restore a single directory, run the restore-me.bat file in the folder.

To prevent irrevocable screw-ups, if "restore-me.bat" or "restore-all.bat" are to be overwritten, backups are made.

After this, you can delete "trim2.vbs" and "64 Char Trim (Recursive).bat". You might wish to burn "del-bat.vbs" and "Delete all batch files (recursive - includes this).bat" to the disc, to clean out the batch files after they are no longer needed. Note, though, that this will delete all files with a .bat extension, recursively into the directory, including itself.


* "Directory" is synonymous with "folder".

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Known bugs and limitations:

o=> If you are running Windows 95 or 98, make sure you update to the latest version of Windows Scripting Host. 2000 and XP are okay. For simply expanding filenames with "restore-xxx.bat" files, no update to WSH is necessary,

o=> If you have a file with an extention longer than 62 characters... I don't know what'll happen. Don't do it.

o=> Make sure none of the files are open or playing when you run the Trim script. It will cause a sharing violation and kill it prematurely. If this happens, run the "expand-all.bat", then the "Delete all batch files", drop the files in again, and retry. If you have a file open in Winamp, stopping (not pausing) seems to be all right.

o=> This script will not change directory names, only files.

o=> If the chop-off point happens to fall between digits of a 2-digit track number, the resulting files may be out of order.

o=> Running "Delete all batch files (recursive - includes this).bat" WILL delete ALL files ending in .bat, recursively within the directory. Be warned. This will also kill the batch files used to run the scripts. If you require them, keep a backup outside of the directory.

o=>The "Delete" will temporarily create a file named "delbat.bat"

o=> This comes with no warranty for fitness, merchantability, or expectation that it won't fuck anything over. Test first, use at your own risk.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Relatively Uncopyrighted (?)2003 Rudy Fleminger