Hello everyone
I need to backup a File.ext in the same folder renaming the backup to: File.1.ext for the 1st time, File.2.ext for the second time, etc
(Or another perhaps easier renaming method)
Can you help me with the code?
Thanks
Sequential file backup
Moderator: DosItHelp
-
- Posts: 240
- Joined: 04 Mar 2014 11:14
- Location: germany
Re: Sequential file backup
Hallo drgt,
What you are looking for is a small versioning of different states of one and the same file or files or folders.
You can find the appropriate script here:
viewtopic.php?t=7903#p52948
Just read the description
Phil
What you are looking for is a small versioning of different states of one and the same file or files or folders.
You can find the appropriate script here:
viewtopic.php?t=7903#p52948
Just read the description
Phil
Sequential file backup
Thanks but assuming we call the script test.bat how exactly is it used?
I.E what is the complete command?
I.E what is the complete command?
-
- Posts: 240
- Joined: 04 Mar 2014 11:14
- Location: germany
Re: Sequential file backup
You can drag one or more folders or files onto the batch.
This corresponds to the full path as a parameter.
This corresponds to the full path as a parameter.
Sequential file backup
What is the OS requirement for this?
I wanted to use it also in an old xp sp2 machine.
Ok. I drag a file onto the batch file?
Where will the target file go?
I wanted to use it also in an old xp sp2 machine.
Ok. I drag a file onto the batch file?
Where will the target file go?
Re: Sequential file backup
DragOneFileOnMe.bat
Code: Select all
@echo off
if "%~1" equ "" (
echo Please close it, drag one file on me.
pause
goto :eof
)
cd /d "%~dp0"
set "n=1"
call :GetNextName "%~n1" "%~x1"
copy "%~1" "%NewName%%~x1"
exit /b
:GetNextName
if exist "%~1.%n%%2" (
set /a n+=1
goto :GetNextName
)
set "NewName=%~1.%n%"
goto :eof