Creation Timestamp Löschskript
Hi alle zusammen,
Ich muss das löschskript für Dateien auf einem Netzlaufwerk von creation timestamp auf modificatin timestamp umändern.
Der sinn daran ist, dass die Dateien nach 7 Tagen auf dem Laufwerk gelöscht werden wobei nicht zählen soll wann die Datei erstellt wurde sondern wann sie zuletzt benutzt wurde.
BZW wann die auf dem Laufwerk gelangt ist.
Dazu habe ich folgendees in meiner Batch Datei :
for /d %%g in ("%1\*") do forfiles /P %%g /S /d -7 /c "cmd /c if @isdir==FALSE del /Q /F @File"
for /d %%g in ("%1\*") do forfiles /P %%g /S /d -7 /c "cmd /c if @isdir==FALSE del /Q /F /A:H @File"
for /d %%g in ("%1\*") do forfiles /P %%g /S /d -7 /c "cmd /c if @isdir==FALSE del /Q /F /A:S @File"
Ich muss das löschskript für Dateien auf einem Netzlaufwerk von creation timestamp auf modificatin timestamp umändern.
Der sinn daran ist, dass die Dateien nach 7 Tagen auf dem Laufwerk gelöscht werden wobei nicht zählen soll wann die Datei erstellt wurde sondern wann sie zuletzt benutzt wurde.
BZW wann die auf dem Laufwerk gelangt ist.
Dazu habe ich folgendees in meiner Batch Datei :
for /d %%g in ("%1\*") do forfiles /P %%g /S /d -7 /c "cmd /c if @isdir==FALSE del /Q /F @File"
for /d %%g in ("%1\*") do forfiles /P %%g /S /d -7 /c "cmd /c if @isdir==FALSE del /Q /F /A:H @File"
for /d %%g in ("%1\*") do forfiles /P %%g /S /d -7 /c "cmd /c if @isdir==FALSE del /Q /F /A:S @File"
Please also mark the comments that contributed to the solution of the article
Content-Key: 371085
Url: https://administrator.de/contentid/371085
Printed on: April 25, 2024 at 00:04 o'clock
3 Comments
Latest comment
Ich seh da kein Problem
Gruß m.
gci "c:\Ordner" -File | ?{$_.LastWriteTime -lt (get-date).Addays(-7)} | del -Force