xtshainge

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"
Auf Facebook teilen
Auf X (Twitter) teilen
Auf Reddit teilen
Auf Linkedin teilen

Content-ID: 371085

Url: https://administrator.de/forum/creation-timestamp-loeschskript-371085.html

Ausgedruckt am: 17.05.2025 um 21:05 Uhr

sabines
sabines 13.04.2018 um 08:35:15 Uhr
Goto Top
Moin,

teste mal:

Get-ChildItem Laufwerk\Pfad | ? { ($_.LastAccessTime -lt (Get-Date).AddDays(-7)) } | % { remove-item $_.Fullname }


Gruss
XTshainge
XTshainge 13.04.2018 um 08:36:11 Uhr
Goto Top
Danke.
135950
135950 13.04.2018 um 08:36:55 Uhr
Goto Top
Ich seh da kein Problem
gci "c:\Ordner" -File | ?{$_.LastWriteTime -lt (get-date).Addays(-7)} | del -Force  
Gruß m.