Answer the question
In order to leave comments, you need to log in
How to make a backup of files copied with replacement in Windows?
From one folder to another, you need to copy the files with the replacement. How can I automatically make copies of only those files that will be replaced? It is desirable that the folder structure be preserved so that, if necessary, copy them back with a replacement.
Answer the question
In order to leave comments, you need to log in
1) you can use a normal version control system , for example, a system - git , there is a ready-made GitHub
service,
look at the info on the network, videos on YouTube, everything will become clear how and what works.
2) you can write scripts yourself, for example, in PowerShell , something like this:
$BackupPath = "D:\SomeBackupPath"
$SourcePath="C:\Some\Source\Path"
$DestinationPath="C:\Some\Destionation\Path"
$7zip="C:\Program Files\7-Zip\7z.exe"
$SourceFiles = ( Get-ChildItem $SourcePath -Recurse -Force | where {$_.Mode -notlike 'd*'} | foreach {$_.FullName.Replace("$SourcePath\","") } )
$DestinationFiles = ( Get-ChildItem $DestinationPath -Recurse -Force | where {$_.Mode -notlike 'd*'} | foreach {$_.FullName.Replace("$DestinationPath\","") } )
$ToPackFiles = @()
$SourceFiles | foreach { if ($DestinationFiles -match "^"+ $_.Replace("\","\\") +"$") { $ToPackFiles += "'$_'" } }
cd $DestinationPath
if ($ToPackFiles) { $ToPackFiles | & $7zip a -mx9 ("$BackupPath\"+(Get-Date -Format "yyyy-MM-dd_HHmmss")+".7z") }
Copy-Item "$SourcePath\*" -Recurse $DestinationPath -Force -PassThru | foreach { Write-Host $_.FullName }
Total Commander will help - if the names match, it will ask what to do, and you can answer it "automatically rename existing files"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question