REACT:Using Short Filenames

From Hydrogenaudio Knowledgebase

It is possible, depending on your file naming scheme, that you may produce file paths that are too long for the command line (255 characters, or 260 for full paths).

If you encounter this problem you can adapt your config file using a workaround to create DOS 8.3 format file paths from their Windows equivalents.


The test code (you can save this as a batch file and run it to see what happens) is as follows:

REM Populate our variable shortValue with the short version of our path
CALL :GetShortPath "C:\This is a long path\to a file.mp3" shortValue

REM Display the short value
ECHO %shortValue%

REM Pause
PAUSE
GOTO:EOF

REM Convert a long file path to a short file path
:GetShortPath
SET %2=%~fs1
GOTO:EOF

This creates a "function" that will convert a long file path to a short file path. The first line passes the long path, and the name of the variable that should be set to the short path value ("shortValue") to the function. The value of "shortValue" is then ECHO'd to the screen.


Below is an example using real config code:

REM Remove original code
REM MOVE /Y "@image@" %dest%
REM MOVE /Y "@cuesheet@" %dest%

REM Create short name variables
CALL :GetShortPath %dest% destShortPath
CALL :GetShortPath "@image@" imageShortPath
CALL :GetShortPath "@cuesheet@" cuesheetShortPath

REM Move using short names
MOVE /Y %imageShortPath% %destShortPath%
MOVE /Y %cuesheetShortPath% %destShortPath%


This requires the following code to be appended to the end of your config file.

:GetShortPath
SET %2=%~fs1
GOTO:EOF

Issues

Warning: Using this technique will result in these files becoming quite unmanageable in Windows. The best solution is to ensure that your paths are as short as possible, e.g.: by ripping and moving to the root of a drive.

One solution to this subsequent issue may be creating a virtual drive, mapped to a long folder path. This can easily be achieved on the command line using SUBST, e.g.:

SUBST R: "C:\Documents and Settings\My Long Name\My Documents\My Music\My Ripped Music"

You can then access "C:\Documents and Settings\My Long Name\My Documents\My Music\My Ripped Music\Pixies\Doolittle\01 - Debaser.mp3" using the virtual path "R:\Pixies\Doolittle\01 - Debaser.mp3".

Using SUBST, the symbolic link will be lost after a reboot. If you want to keep the mapping after reboot there are a few suggestions in the following links: