Jump to content

Aufhanmen nach x Tagen automatisch löschen


Michael Scholze

Recommended Posts

Ich vermisse folgende Funktion:

 

Aufnahmen, die älter als x Tage sind, sollen automatisch gelöscht werden. Bei jeder Aufnahme (auch Autotimer) sollte man angeben können,

nach wie vielen Tagen diese gelöscht werden soll. So kann man z.B. immer die letzte Nachrichtensendung auf Platte haben.

 

ms

Link to comment
  • 2 weeks later...

Mach ich lieber mit einem Script in der Aufgabenplanung.

 

del.vbs

 

DIM fs,mFolder,f,fc,f1,checkpath,olderthan

'in diesem Ordner wird nach alten Files gesucht
checkpath = "E:\Captured Files"
'soviele Tage alt dürfen die Files sein
olderthan = 10


set FS = CreateObject("scripting.filesystemobject")
Set f = fs.GetFolder(checkpath)
Set fc = f.Files

For Each f1 in fc
filedate = cdate(left(f1.datelastmodified,10))
if filedate <= (date - olderthan) then
fs.DeleteFile f1
end if
Next

 

Link to comment
  • 1 month later...

Mach ich lieber mit einem Script in der Aufgabenplanung.

 

del.vbs

Quote

 

DIM fs,mFolder,f,fc,f1,checkpath,olderthan

 

'in diesem Ordner wird nach alten Files gesucht

checkpath = "E:\Captured Files"

'soviele Tage alt dürfen die Files sein

olderthan = 10

 

 

set FS = CreateObject("scripting.filesystemobject")

Set f = fs.GetFolder(checkpath)

Set fc = f.Files

 

For Each f1 in fc

filedate = cdate(left(f1.datelastmodified,10))

if filedate <= (date - olderthan) then

fs.DeleteFile f1

end if

Next

 

 

 

Ich möchte nicht kleinlich sein, aber kleine Ergänzung:

 

"DIM fs,mFolder,f,fc,f1,checkpath,olderthan,filedate"

Link to comment
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...