0

I currently have robocopy monitoring files in a folder for changes. When any files changes, robocopy does it job by making a copy. The problem is, I see no way to have multiple copies of the same file, as robocopy overwrites. The result should be no different than if you right-click>copy then right-click>paste in the same folder:

data.txt 
data - copy.txt 
data - copy(2).txt 
data - copy(3).txt 
.... - copy(n).txt

So I either need a robocopy command (though I didn't see any) to copy and rename subsequent files, or something like robocopy that can monitor and copy without overwriting but do some sort of subsequent naming convention.

My 30 hours of searching for an answer never comes up with what I need or I don't know how to search for it properly.

2
  • If you could have the Robocopy destination folder be datetime stamped like FolderName_20220617_0900AM of just the files that are different since the last backup, you could have robocopy just log it, and then read the log file with PowerShell and parse the NEW lines and get the full paths of the NEW file, and then just copy those from the original destination to the date and time appended folder. SO technically you would monitor a source folder and different working folder and then copy just the changed files that period to the date time archived area. I think it could work. Ideas only!! Jun 17, 2022 at 4:52
  • Actually I wrote this answer that should help with that sort of idea to get you started maybe if that sounds like it'd suffice. superuser.com/questions/1720375/… Jun 17, 2022 at 4:55

1 Answer 1

0
@echo off && setlocal

set "_files=LostIsland.ark,1153356741.arktribe,LocalPlayer.arkprofile"
set "_dirBk=D:\Program Files (x86)\Steam\steamapps\common\ARK\ShooterGame\Saved\LostIslandSavedArksLocal"

%:^)
for %%i in (%_files%)do 2>nul (
     fc "%_dirBk%\%%~nxi" "%_dirBk%\Backup Files\%%~nxi" /b | findstr /b "FC:.no.*" >nul || (
         call %:^O "%%~nxi" "%_dirBk%\Backup Files" 
        )
    )
    
timeout /t 60 /nobreak >nul & goto %:^)

%:^O
if "%~nx1" == "" (endlocal && exit /b)else pushd "%~2"
for /l %%L in (1,1,99)do if not exist .\"%~n1(%%~L)%~x1" (
     copy ..\"%~nx1" . && copy ..\"%~1" ".\%~n1(%%~L)%~x1"
     popd & exit /b
    )

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .