Command-Line usage on only ONE specific file
Posted: Sat Jan 25, 2020 3:26 am
Good morning,
I just stumbled across this beautiful piece of software and am looking forward to using it in the future. I have one question though:
Is there a way to rename only one specific file? The reason being: I often have to rename files to "MODIFIED DATE - ORIGINAL FILENAME". This is usually done on a "by-file-base". So I created a batch (Win10x64pro) file, in which I only have to drag in the file which has to be renamed:
However, if the filenames are similar the program wants to rename all of them. My testfiles are:
The batch works fine for the first 2, the second 2 don't work. Every filename containing spaces is giving me trouble : (
Anyone having that problem as well?
Kind regards
Dennis
I just stumbled across this beautiful piece of software and am looking forward to using it in the future. I have one question though:
Is there a way to rename only one specific file? The reason being: I often have to rename files to "MODIFIED DATE - ORIGINAL FILENAME". This is usually done on a "by-file-base". So I created a batch (Win10x64pro) file, in which I only have to drag in the file which has to be renamed:
- Code: Select all
@echo off
:start
cls
set /p input="Drop File... -> "
if not exist %input% goto endFAILURE
echo.
echo ---
echo.
rem -----
rem https://stackoverflow.com/a/37449850
for %%A in (%input%) do (set defilepathname=%%~fA)
for %%A in (%input%) do (set defilepath=%%~dA%%~pA)
for %%A in (%input%) do (set defilename=%%~nA%%~xA)
rem -----
echo Dropped: %input%
echo deFilePathName: %defilepathname%
echo deFilePath: %defilepath%
echo deFileName: %defilename%
echo.
echo ---
B:\ren\BRC64.exe /DIR:"%defilepath%" /INCLH /INCLR /PATTERN:"%defilename%" /APPENDDATE:M:P:::10:%%Y.%%m.%%d", "%%H.%%M.%%S" ("%%a") - " /TIDYDS /TRIM /NODUP
goto end
:endFAILURE
echo.
echo.
echo FAILURE!
echo.
echo.
echo Press any key to exit . . .
echo.
pause > nul
goto end
:end
echo off | clip
timeout -t 3
However, if the filenames are similar the program wants to rename all of them. My testfiles are:
- test
test.txt
test test.txt
1000.01.25, 02.39 - test test.txt
The batch works fine for the first 2, the second 2 don't work. Every filename containing spaces is giving me trouble : (
Drop File... -> "B:\- ! private\Desktop\test test.txt"
---
Dropped: "B:\- ! private\Desktop\test test.txt"
deFilePathName: B:\- ! private\Desktop\test test.txt
deFilePath: B:\- ! private\Desktop\
deFileName: test test.txt
---
Processing Folder B:\- ! private\Desktop\
Filename test would be renamed to 2020.01.25, 02.32.39 (Sat) - test
Filename test.txt would be renamed to 2020.01.25, 02.32.39 (Sat) - test.txt
Waiting for 2 seconds, press a key to continue ...
Anyone having that problem as well?
Kind regards
Dennis