Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

NT tool to delete files by date?

Thread Tools
 
Search this Thread
 
Old Aug 6, 2002 | 11:23 AM
  #1  
father_jack's Avatar
father_jack
Thread Starter
Scooby Regular
 
Joined: Jul 2001
Posts: 1,112
Likes: 0
Post

Chaps,

Anyone know of anything in the resource kit or elsewhere to delete files older than a given date or after a given number of days?
Robocopy lets me copy stuff to another folder then delete it, but it's not quite right.

Cheers
Reply
Old Aug 6, 2002 | 11:36 AM
  #2  
ChrisS/P1's Avatar
ChrisS/P1
Scooby Regular
 
Joined: Feb 2002
Posts: 459
Likes: 0
From: Newcastle
Post

If you can't find an NT utility, theres nothing wrong with using a DOS utility.
Reply
Old Aug 6, 2002 | 11:38 AM
  #3  
father_jack's Avatar
father_jack
Thread Starter
Scooby Regular
 
Joined: Jul 2001
Posts: 1,112
Likes: 0
Post

For example
Reply
Old Aug 6, 2002 | 11:48 AM
  #4  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

gimme 2 mins.

David
Reply
Old Aug 6, 2002 | 11:52 AM
  #5  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

this might do what you want?? cant you just do a search in windows then delete the results...


'
' Script to delete files older than a given number of days.
'
' WARNING: Files deleted with this program could not be recovered. They don't even get to Recycle Bin.
' Use at your own risk.
'
' (C) Copyright, 2002. Ferran Foz. Barcelona, Spain. ferran@ostres.com
'
' You may copy and distribute without changing the copyright notice.
'
'
Set StdOut = WScript.StdOut

Main

Sub Main()
'
' DropOldFiles
' folderspec - Folder where you want to delete files
' logfile - File where logfile will be generated.
' days - Number of days to keep files.
'
Call DropOldFiles("C:\zzTEMP\","C:\TEMP\LOG.TXT", 100)
End Sub

Sub DropOldFiles(folderspec, logfile, days)
Dim fso,f,f1,s,fi, cnt, tot

StdOut.WriteLine "Starting DropOldFiles..."

LogOpen(logfile)
cnt = 0
tot = 0

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
If DateDiff ("d",f1.DateLastModified, Now ) > days Then
LogWrite f1.name & " DateLastModified:" & f1.DateLastModified & " DaysOld:" & DateDiff ("d",f1.DateLastModified, Now )
fso.DeleteFile (folderspec & f1.name)
cnt = cnt + 1
End If
tot = tot + 1
Next
LogWrite "--------------------------------------------------------------"
LogWrite " Processed " & tot & " file(s). Deleted " & cnt & " file(s)."
LogWrite "--------------------------------------------------------------"
LogClose
StdOut.WriteLine "Ending DropOldFiles..."

End Sub

'
' ************************************************** ***************************************
'
'
' Write to the Logfile
'

Dim LogFile

Sub LogWrite (Text)
LogFile.WriteLine "[" & Now & "] " & Text
End Sub

Sub LogClose ()
LogFile.Close
Set Logfile=nothing
End Sub

Sub LogOpen (LogPath)
Dim fso, f1
Const ForAppend = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set LogFile = fso.OpenTextFile(LogPath, ForAppend, True)
Set fso = nothing
End Sub

David
Reply
Old Aug 6, 2002 | 11:57 AM
  #6  
father_jack's Avatar
father_jack
Thread Starter
Scooby Regular
 
Joined: Jul 2001
Posts: 1,112
Likes: 0
Post

Cheers - That was quick I'll give it a go, but kinda want to do it in DOS to pipe it back to a file, there must be a command line utility.
It's for copying Wininstall packages from a master build server to all other build server across the network, so I can search and destroy older software and copy out new stuff (there are about 50 build servers).


Cheers

FJ
Reply
Old Aug 6, 2002 | 01:23 PM
  #7  
David_Wallis's Avatar
David_Wallis
Scooby Regular
 
Joined: Nov 2001
Posts: 15,239
Likes: 1
From: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Post

Robocopy /Mirror /purge or similar?
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Pro-Line Motorsport
Car Parts For Sale
48
Jul 21, 2017 09:50 PM
Ganz1983
Subaru
5
Oct 2, 2015 09:22 AM
yabbadoo4
ScoobyNet General
11
Sep 30, 2015 10:33 PM
Nick_Cat
Computer & Technology Related
2
Sep 26, 2015 08:00 AM
Littleted
Computer & Technology Related
0
Sep 25, 2015 08:44 AM




All times are GMT +1. The time now is 02:52 AM.