You can always try using the
for command with the parameter modifiers. If the files have a short filename at all, the following command should work when typed in the Run dialog box or on the command line:
cmd /c for %F /d /r in ("input\*.*") do @xcopy /i "%~F" "temp%~spF%~snF%~xF"
input with your real folder name, of course. This will put all the short filenames in the
temp, but inside of one or more other folders. Simply keep opening folders until you get to the
input folder, rename it to whatever you want to call it, and move it where you want it. Then delete the
If you don't have any short filenames, you'll have to generate them yourself instead. Using your preferred method, copy all your file from the input folder to the destination. Then copy and paste the following into Notepad:
for /r /d %%F in (*.*) do call :START "%%~F"
for /r %%F in (*.*) do call :START "%%~F"
set short=%name: =%
set /a num += 1
if /i %num% GEQ 10 set short=%short:~0,5%&& echo +10
if /i %num% GEQ 100 set short=%short:~0,4%&& echo +100
if /i %num% GEQ 1000 set short=%short:~0,3%&& echo +1000
if exist "%path%%short%~%num%%ext%" GOTO LOOP
move "%~1" "%path%%short%~%num%%ext%"
Save it as "8dotX.bat" (including the quotes). To run it, drag the copied folder onto it, and all the files and folders in it will be renamed.
Note, this isn't 100% complete, in that filenames that are already short will still be renamed, and the equals sign (=) will not be replaced with _ as it would be in DOS. The former is because handling it correctly would make the batch file take at least twice as long to complete, and the latter is because it can't be done in pure BATCH. It also is limited to only 9999 files with the same beginning letters, and does not bother with changing the filenames to uppercase. I think these limitation will still work with your use case.