XCOPY soll bestehende Datei nicht überschreiben sondern neue Version erstellen
Momentan steh ich am Schlauch... wie parametriert man XCOPY, damit eine bestehende Datei nicht überschrieben sondern neue Version erstellt wird... z.B. mit dem Zusatz (2) o.ä. ?
Oder geht das nur mit einem Batch... Wie tät das dann aussehen?
Vielen Dank für Tipps,
Gruß
Wolfgang
Oder geht das nur mit einem Batch... Wie tät das dann aussehen?
Vielen Dank für Tipps,
Gruß
Wolfgang
Please also mark the comments that contributed to the solution of the article
Content-Key: 560401
Url: https://administrator.de/contentid/560401
Printed on: April 26, 2024 at 19:04 o'clock
5 Comments
Latest comment
Moin Moin,
schau dir mal diesen Beitrag an:
Robocopy unter Beibehaltung alter Dateiversionen ausführen
Mein Senf
Tom
schau dir mal diesen Beitrag an:
Robocopy unter Beibehaltung alter Dateiversionen ausführen
Mein Senf
Tom
Einfach Versionierung , auch schnell mit PS zusammen gescriptet
$quelle = 'D:\quelle'
$ziel = 'E:\ziel'
gci $quelle -Recurse -Force | %{
$targetfile = $_.FullName -replace [regex]::Escape($quelle),$ziel
if ($_.PSIsContainer){
if (!(Test-Path $targetfile)){md $targetfile -Force -Verbose | out-null}
}else{
$targetdir = split-path $targetfile -Parent
if (!(Test-Path $targetdir)){md $targetdir -Force | out-null}
if (Test-Path $targetfile){
if ($_.Length -ne (get-item $targetfile).Length -or $_.LastWriteTime -ne (Get-Item $targetfile).LastWriteTime){
$targetfile = "$targetdir\$($_.BaseName)_$(get-date -F yyyyMMdd-HHmmss)$($_.Extension)"
}else{
$targetfile = ''
}
}
if ($targetfile -ne ''){
$_ | copy-item -Destination $targetfile -Force -Verbose
}
}
}
Zitat von @mausebaer:
...Oh... es scheint doch nicht so einfach zu sein... Ich muß mir das alles mal zu Gemüte führen...
Sind halt keine Katzenvideos ....Oh... es scheint doch nicht so einfach zu sein... Ich muß mir das alles mal zu Gemüte führen...