REACT:Using Short Filenames

From Hydrogenaudio Knowledgebase
Revision as of 11:55, 17 April 2007 by Synthetic Soul (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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