Sign in with
Sign up | Sign in
Your question

how to delete folders and files older than 14 days old

Last response: in Windows 2000/NT
Share
September 9, 2004 3:52:43 PM

Archived from groups: microsoft.public.win2000.security (More info?)

I have been asked by our engineering dept to automatically delete all
files folders and subfolders older than 14 days old located in our FTP
folder on a windows 2000 server. I have seen several threads about
this but don't have the skills to create a program to do this.

Is there any software out here that will do this task? If not is
there a way someone could walk me through creating a script to do
this?

Thanks,
Eric

More about : delete folders files older days

Anonymous
September 9, 2004 7:11:20 PM

Archived from groups: microsoft.public.win2000.security (More info?)

You do need a script. There are free DOS command line utilities you can
find in Google that will simplify doing this. Try here:

http://www.google.com/search?q=delete+files+age+dos+uti...

If you prefer a script like a VBS / WSH script, I'm sure those are in google
too:

http://www.google.com/search?q=delete+files+age+script+...


"Eric" <administrator@halexco.com> wrote in message
news:69627a12.0409091052.3bc8faf0@posting.google.com...
> I have been asked by our engineering dept to automatically delete all
> files folders and subfolders older than 14 days old located in our FTP
> folder on a windows 2000 server. I have seen several threads about
> this but don't have the skills to create a program to do this.
>
> Is there any software out here that will do this task? If not is
> there a way someone could walk me through creating a script to do
> this?
>
> Thanks,
> Eric
September 10, 2004 3:34:44 AM

Archived from groups: microsoft.public.win2000.security (More info?)

Try this great (free) tool
it si GUI based and Command line based (therfor can be put in a simple command file and f.i. scheduled every day)

http://www.savilltech.com/download.html

DelOld, version 2003 Been around for years. this latest version reads "beta" but is robust rock solid.
"A great utility to remove files matching a certain age and specification"

gr,
Erwin




"Eric" <administrator@halexco.com> wrote in message news:69627a12.0409091052.3bc8faf0@posting.google.com...
>I have been asked by our engineering dept to automatically delete all
> files folders and subfolders older than 14 days old located in our FTP
> folder on a windows 2000 server. I have seen several threads about
> this but don't have the skills to create a program to do this.
>
> Is there any software out here that will do this task? If not is
> there a way someone could walk me through creating a script to do
> this?
>
> Thanks,
> Eric
Related resources
Anonymous
September 10, 2004 1:12:37 PM

Archived from groups: microsoft.public.win2000.security (More info?)

Eric,

I had to do the same exact thing about 2 months ago. Below is a script
that will take care of it. The only thing you should need to change is
the "dir" variable which is the "root" directory which houses your FTP
files. The scan is recursive so it will also get any files in any of
the subfolders under the root directory.

If you need any help with it let me know and I'll do what I can.

Regards,
SWBradbury

-----------------------------

'This script scans through the FTP folders and deletes all files older
than 14 days.
'Process began on June 1st, 2004
'Written by SWBradbury

Option Explicit
' Create the FileSystem Object
dim oFileSys
dim dir
'Directory to be scanned
dir = "D:\FTPfiles"

Set oFileSys = CreateObject("Scripting.FileSystemObject")

'Start up Sub
GetDir dir

sub GetDir(dir)
dim oFolder,oFolders,oFiles,item,Item2

set oFolder=oFileSys.GetFolder(dir)
set oFolders=oFolder.SubFolders
set oFiles=oFolder.Files

' get all sub-folders in this folder
For each item in oFolders
GetDir(item)
Next
item2=0

'Scan through the files collection, find files older than 14 days,
and delete.
For each item2 in oFiles
Dim accessDate,createdate,fDateInfo,DaysOld
Set fDateInfo = oFileSys.GetFile(item2)
createdate = fDateInfo.DateCreated
accessDate = fDateInfo.DateLastAccessed
DaysOld = DateDiff("d", accessDate, Now)

If DaysOld > 14 Then
item2.delete
end if

next

end sub

-----------------------------


"Ernie" <guess@where.com> wrote in message news:<4140cc75$0$88498$e4fe514c@dreader15.news.xs4all.nl>...
> Try this great (free) tool
> it si GUI based and Command line based (therfor can be put in a simple command file and f.i. scheduled every day)
>
> http://www.savilltech.com/download.html
>
> DelOld, version 2003 Been around for years. this latest version reads "beta" but is robust rock solid.
> "A great utility to remove files matching a certain age and specification"
>
> gr,
> Erwin
>
>
>
>
> "Eric" <administrator@halexco.com> wrote in message news:69627a12.0409091052.3bc8faf0@posting.google.com...
> >I have been asked by our engineering dept to automatically delete all
> > files folders and subfolders older than 14 days old located in our FTP
> > folder on a windows 2000 server. I have seen several threads about
> > this but don't have the skills to create a program to do this.
> >
> > Is there any software out here that will do this task? If not is
> > there a way someone could walk me through creating a script to do
> > this?
> >
> > Thanks,
> > Eric
Anonymous
September 11, 2004 2:04:00 AM

Archived from groups: microsoft.public.win2000.security (More info?)

SWBradbury wrote:

> Eric,
>
> I had to do the same exact thing about 2 months ago. Below is a script
> that will take care of it. The only thing you should need to change is
> the "dir" variable which is the "root" directory which houses your FTP
> files. The scan is recursive so it will also get any files in any of
> the subfolders under the root directory.
>
> [snip first part of code]
>
> 'Scan through the files collection, find files older than 14 days,
> and delete.
> For each item2 in oFiles
> Dim accessDate,createdate,fDateInfo,DaysOld
> Set fDateInfo = oFileSys.GetFile(item2)
> createdate = fDateInfo.DateCreated
> accessDate = fDateInfo.DateLastAccessed
> DaysOld = DateDiff("d", accessDate, Now)
>
> If DaysOld > 14 Then
> item2.delete
> end if
>
> next
Hi

Note that when deleting files, you should *never* do this when still
looping in the file collection returned from the File System Object
(FSO). The collection may get mixed up with unpredictable results.
E.g. create an array of the file paths first to avoid this.

In the article below there is a WSH script (vbscript) by Michael
Harris that deletes files x days old in a specific folder (and
optionally all subfolders), using an array of the file paths.

Newsgroups: microsoft.public.scripting.wsh
Date: 2002-10-07 08:12:33 PST
http://groups.google.com/groups?selm=3DA1A19B.DF9B06D7%...



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.m...
Anonymous
December 15, 2004 5:27:56 PM

Archived from groups: microsoft.public.win2000.security (More info?)

I have used a program called GNDEL. It seems to work pretty good. You
can get it from WWW.Reg.net.


Torgeir Bakken (MVP) wrote:
> SWBradbury wrote:
>
> > Eric,
> >
> > I had to do the same exact thing about 2 months ago. Below is a
script
> > that will take care of it. The only thing you should need to change
is
> > the "dir" variable which is the "root" directory which houses your
FTP
> > files. The scan is recursive so it will also get any files in any
of
> > the subfolders under the root directory.
> >
> > [snip first part of code]
> >
> > 'Scan through the files collection, find files older than 14
days,
> > and delete.
> > For each item2 in oFiles
> > Dim accessDate,createdate,fDateInfo,DaysOld
> > Set fDateInfo = oFileSys.GetFile(item2)
> > createdate = fDateInfo.DateCreated
> > accessDate = fDateInfo.DateLastAccessed
> > DaysOld = DateDiff("d", accessDate, Now)
> >
> > If DaysOld > 14 Then
> > item2.delete
> > end if
> >
> > next
> Hi
>
> Note that when deleting files, you should *never* do this when still
> looping in the file collection returned from the File System Object
> (FSO). The collection may get mixed up with unpredictable results.
> E.g. create an array of the file paths first to avoid this.
>
> In the article below there is a WSH script (vbscript) by Michael
> Harris that deletes files x days old in a specific folder (and
> optionally all subfolders), using an array of the file paths.
>
> Newsgroups: microsoft.public.scripting.wsh
> Date: 2002-10-07 08:12:33 PST
> http://groups.google.com/groups?selm=3DA1A19B.DF9B06D7%...
>
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.m...
Anonymous
July 12, 2011 9:07:10 AM

I use FileDestroyer

http://sourceforge.net/projects/filedestroyer/

Here is a short tutorial:

http://arturito.net/2010/07/13/file-destroyer-clean-upf...

Usage:

FileDestroyer.exe -scan “D:\SQLBackup” -ext bak -log “D:\Logs\” –days 2

This command scans folder “D:\SQLBackup” looks for extension .bak and removes backups/files older than 2 days and it logs everything in D:\Logs\

It also supports UNC Paths (\\server1\shared\backups\)

(Disclaimer: I'm the author of this utility)
March 28, 2013 10:47:20 PM

Eric said:
Archived from groups: microsoft.public.win2000.security (More info?)

I have been asked by our engineering dept to automatically delete all
files folders and subfolders older than 14 days old located in our FTP
folder on a windows 2000 server. I have seen several threads about
this but don't have the skills to create a program to do this.

Is there any software out here that will do this task? If not is
there a way someone could walk me through creating a script to do
this?

Thanks,
Eric


April 17, 2013 7:54:48 AM

Yes there is a software, but that will help you to monitor all the files and folder with in a server and moreover once like monitoring is the basic function of the tool apart from this if you want then at that moment of time you can delete the unused folders also. If you want i can name it.

Thanks.
!