Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 01-04-2007, 01:46 AM
Stingray
Tablet PC Guest
 
Posts: n/a
Date Based File Purge

I am looking for a solution to a problem I've been wrestling with for a
couple years and so far I've hid dead ends. I have a low-end NAS device that
we use for storage of our security camera files and have a need to
periodically remove files older than a given date. The big problem is, since
it's a Unix based OS rather than Windows Storage Server based, we cannot
connect to it directly with our backup server, which would be able to do a
simple archive backup and purge the backed up files for us.

I've been searching through utility packages and scripting sites and have
not found anywhere how I could automate the process of searching a directory
tree on a mapped drive and delete any files older than a specified date. Does
anyone out there have any ideas? I'd prefer something that's already written
but I'm not totally opposed to some coding as long as it doesn't get to
advanced. I appreciate any advice or suggestions.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 01-04-2007, 01:46 AM
Xploder HD Movie Player for PS3. Manage, convert and transfer media files between the PC and PS3.
  #2 (permalink)  
Old 01-04-2007, 01:46 AM
Pegasus \(MVP\)
Tablet PC Guest
 
Posts: n/a
Re: Date Based File Purge


"Stingray" <Stingray@discussions.microsoft.com> wrote in message
news:C34BADBB-AE98-4B21-B228-CE103B93B8C8@microsoft.com...
> I am looking for a solution to a problem I've been wrestling with for a
> couple years and so far I've hid dead ends. I have a low-end NAS device

that
> we use for storage of our security camera files and have a need to
> periodically remove files older than a given date. The big problem is,

since
> it's a Unix based OS rather than Windows Storage Server based, we cannot
> connect to it directly with our backup server, which would be able to do a
> simple archive backup and purge the backed up files for us.
>
> I've been searching through utility packages and scripting sites and have
> not found anywhere how I could automate the process of searching a

directory
> tree on a mapped drive and delete any files older than a specified date.

Does
> anyone out there have any ideas? I'd prefer something that's already

written
> but I'm not totally opposed to some coding as long as it doesn't get to
> advanced. I appreciate any advice or suggestions.
>
>


Both xxcopy.exe and robocopy.exe have switches that let
you delete files selectively. xxcopy is downloadable from a
number of sites and robocopy comes with the Windows
Resource Kit.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 01-04-2007, 05:30 AM
n_t_schultz@hotmail.com
Tablet PC Guest
 
Posts: n/a
Re: Date Based File Purge

Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c::\test")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 15 Then
f1.Delete
End If
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing


This VB script was posted in another forum that should help you. I am
checking with a friend to see if he can modify the script so I can also
specify a file type as well. When I get that one back I will post it
too.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 01-04-2007, 05:30 AM
n_t_schultz@hotmail.com
Tablet PC Guest
 
Posts: n/a
Re: Date Based File Purge

Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c::\test")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 15 Then
f1.Delete
End If
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing


This VB script was posted in another forum that should help you. I am
checking with a friend to see if he can modify the script so I can also
specify a file type as well. When I get that one back I will post it
too.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 01-04-2007, 05:33 AM
n_t_schultz@hotmail.com
Tablet PC Guest
 
Posts: n/a
Re: Date Based File Purge

I have done some basic testing on revised script on the code provided
earlier. This VB code will allow you to specify the folder, file
extension, and date.

FYI you will need to save the file as a VBS and the run it from the
command like this:

wscript filename.vbs
or like
cscript filename.vbs


Dim fso, f, f1, fc
Dim temp, pos
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c:\test") 'Gets the folder
Set fc = f.Files 'gets all of the files in the folder, makes a
collection
For Each f1 in fc 'increments through each of the files in fc
temp = f1.name 'get file name
temp=right(temp,4) 'get the last 4 characters in the string (match
this to the number of characters in the if statement (.txt = 4)
if(temp = ".txt" AND DateDiff("d", f1.DateLastModified, Now) >
15) then 'only delete if it is the correct file type and so old
f1.delete
end if
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #6 (permalink)  
Old 01-04-2007, 05:33 AM
n_t_schultz@hotmail.com
Tablet PC Guest
 
Posts: n/a
Re: Date Based File Purge

I have done some basic testing on revised script on the code provided
earlier. This VB code will allow you to specify the folder, file
extension, and date.

FYI you will need to save the file as a VBS and the run it from the
command like this:

wscript filename.vbs
or like
cscript filename.vbs


Dim fso, f, f1, fc
Dim temp, pos
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("c:\test") 'Gets the folder
Set fc = f.Files 'gets all of the files in the folder, makes a
collection
For Each f1 in fc 'increments through each of the files in fc
temp = f1.name 'get file name
temp=right(temp,4) 'get the last 4 characters in the string (match
this to the number of characters in the if statement (.txt = 4)
if(temp = ".txt" AND DateDiff("d", f1.DateLastModified, Now) >
15) then 'only delete if it is the correct file type and so old
f1.delete
end if
Next
Set fso = Nothing
Set f = Nothing
Set fc = Nothing

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apple and HP readying LED-based notebooks? LPH Tablet PC Bloggers 0 01-03-2007 04:10 PM
Windows Mail: Delete/Purge works differently in IMAP Craig L Windows Vista 10 01-02-2007 10:26 AM
Membership Purge | Forum Rearrangements | New Skin LPH Announcements 0 10-31-2004 02:42 PM
Pen-Based Typing for Tablet PC - AlphaTap! AlphaTap News Windows XP Tablet PC Newsgroup 4 05-26-2004 09:10 PM
Tablet PCs based on the Dothan Chips LPH Tablet PC - In The News 4 05-15-2004 11:35 AM


All times are GMT -8. The time now is 01:29 PM.


2003 - 2008 All Rights Reserved. Technology Questions

SEO by vBSEO 3.1.0