|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Delete Files Based On Date
We are trying to come up with a way to delete files based on how long they
have lived in a folder. In our case our FTP server. With so many of the scripts being based on Creation Data, Modified or Last Accessed Date we havent been able to come across a script that would work for us because a user may tranfser a file to the FTP server and if the script is based on the creation date then in could be deleted the next day. If based on the Last Accessed date a user could constantly keep opening the file to keep it from being deleted. I have come across two potential attributes that may work, MaxAge and rentention Period but I havent been able to find out exactly what they are. Any ideas would be great!! Hi Brennan,
This sounds like job for a script that keeps a separate list of filenames in a simple text file with a date stamp next to each filename. A scheduled task would run another/same script to scan the FTP folder each day or whatever - comparing each file to the list you made on day 1. If a file in the FTP folder is x days old compared to your list - then delete it. Of course you add other files and check for duplicate entries etc. but that would be how I would do it. Hope that helps. CreateWindow http://justpageprobe.com The FREE Web page scan utility you always wanted. Keep your router connected. Email your IP to where you need it. Monitor your enterprise Web Servers. Show quote "Brennan" <Bren***@discussions.microsoft.com> wrote in message news:E95CD450-FD53-4033-ACB7-2592DAC44FFB@microsoft.com... > We are trying to come up with a way to delete files based on how long they > have lived in a folder. In our case our FTP server. With so many of the > scripts being based on Creation Data, Modified or Last Accessed Date we > havent been able to come across a script that would work for us because a > user may tranfser a file to the FTP server and if the script is based on > the > creation date then in could be deleted the next day. If based on the Last > Accessed date a user could constantly keep opening the file to keep it > from > being deleted. > I have come across two potential attributes that may work, MaxAge and > rentention Period but I havent been able to find out exactly what they > are. > > Any ideas would be great!! > > You still need to concern yourself with what that "date stamp" actually
means. If, once uploaded, some of the files may be validly updated, you might not want to delete them once they have been living there. So Brennan's script will create an entry for a new file giving the date it was first noticed there, but the script to do the deletions might need to also consider last changed date. /Al Show quote "CreateWindow" <createwin***@gmail.com> wrote in message news:SKydnTfXx8Aj3KTbnZ2dnUVZ_qmdnZ2d@giganews.com... > Hi Brennan, > > This sounds like job for a script that keeps a separate list of filenames > in a simple text file with a date stamp next to each filename. > A scheduled task would run another/same script to scan the FTP folder each > day or whatever - comparing each file to the list you made on day 1. > If a file in the FTP folder is x days old compared to your list - then > delete it. Of course you add other files and check for duplicate entries > etc. but that would be how I would do it. > > Hope that helps. > > CreateWindow > http://justpageprobe.com > The FREE Web page scan utility you always wanted. > Keep your router connected. > Email your IP to where you need it. > Monitor your enterprise Web Servers. > > > > > "Brennan" <Bren***@discussions.microsoft.com> wrote in message > news:E95CD450-FD53-4033-ACB7-2592DAC44FFB@microsoft.com... >> We are trying to come up with a way to delete files based on how long >> they >> have lived in a folder. In our case our FTP server. With so many of the >> scripts being based on Creation Data, Modified or Last Accessed Date we >> havent been able to come across a script that would work for us because a >> user may tranfser a file to the FTP server and if the script is based on >> the >> creation date then in could be deleted the next day. If based on the Last >> Accessed date a user could constantly keep opening the file to keep it >> from >> being deleted. >> I have come across two potential attributes that may work, MaxAge and >> rentention Period but I havent been able to find out exactly what they >> are. >> >> Any ideas would be great!! >> >> > > Hi Al,
Good point! ( I just took the below from Brennan to mean that "updates" were rare or naughty in some way. ) >> Accessed date a user could constantly keep opening the file to keep it CreateWindow>> from >> being deleted. Show quote "Al Dunbar" <AlanD***@hotmail.com.nospaam> wrote in message news:umSaSezjHHA.4248@TK2MSFTNGP06.phx.gbl... > You still need to concern yourself with what that "date stamp" actually > means. If, once uploaded, some of the files may be validly updated, you > might not want to delete them once they have been living there. So > Brennan's script will create an entry for a new file giving the date it > was first noticed there, but the script to do the deletions might need to > also consider last changed date. > > /Al > > "CreateWindow" <createwin***@gmail.com> wrote in message > news:SKydnTfXx8Aj3KTbnZ2dnUVZ_qmdnZ2d@giganews.com... >> Hi Brennan, >> >> This sounds like job for a script that keeps a separate list of filenames >> in a simple text file with a date stamp next to each filename. >> A scheduled task would run another/same script to scan the FTP folder >> each day or whatever - comparing each file to the list you made on day 1. >> If a file in the FTP folder is x days old compared to your list - then >> delete it. Of course you add other files and check for duplicate entries >> etc. but that would be how I would do it. >> >> Hope that helps. >> >> CreateWindow >> http://justpageprobe.com >> The FREE Web page scan utility you always wanted. >> Keep your router connected. >> Email your IP to where you need it. >> Monitor your enterprise Web Servers. >> >> >> >> >> "Brennan" <Bren***@discussions.microsoft.com> wrote in message >> news:E95CD450-FD53-4033-ACB7-2592DAC44FFB@microsoft.com... >>> We are trying to come up with a way to delete files based on how long >>> they >>> have lived in a folder. In our case our FTP server. With so many of the >>> scripts being based on Creation Data, Modified or Last Accessed Date we >>> havent been able to come across a script that would work for us because >>> a >>> user may tranfser a file to the FTP server and if the script is based >>> on the >>> creation date then in could be deleted the next day. If based on the >>> Last >>> Accessed date a user could constantly keep opening the file to keep it >>> from >>> being deleted. >>> I have come across two potential attributes that may work, MaxAge and >>> rentention Period but I havent been able to find out exactly what they >>> are. >>> >>> Any ideas would be great!! >>> >>> >> >> > > My bad, I mixed you two up, thinking that your reply was Brennan's, I should
have referred to "CreateWindow's script" instead - sheesh. /Al Show quote "CreateWindow" <createwin***@gmail.com> wrote in message news:2_OdnSHCX-0DjaDbnZ2dnUVZ_qGdnZ2d@giganews.com... > Hi Al, > > Good point! > > ( I just took the below from Brennan to mean that "updates" were rare or > naughty in some way. ) > >>> Accessed date a user could constantly keep opening the file to keep it >>> from >>> being deleted. > > CreateWindow > > > "Al Dunbar" <AlanD***@hotmail.com.nospaam> wrote in message > news:umSaSezjHHA.4248@TK2MSFTNGP06.phx.gbl... >> You still need to concern yourself with what that "date stamp" actually >> means. If, once uploaded, some of the files may be validly updated, you >> might not want to delete them once they have been living there. So >> Brennan's script will create an entry for a new file giving the date it >> was first noticed there, but the script to do the deletions might need to >> also consider last changed date. >> >> /Al >> >> "CreateWindow" <createwin***@gmail.com> wrote in message >> news:SKydnTfXx8Aj3KTbnZ2dnUVZ_qmdnZ2d@giganews.com... >>> Hi Brennan, >>> >>> This sounds like job for a script that keeps a separate list of >>> filenames in a simple text file with a date stamp next to each filename. >>> A scheduled task would run another/same script to scan the FTP folder >>> each day or whatever - comparing each file to the list you made on day >>> 1. >>> If a file in the FTP folder is x days old compared to your list - then >>> delete it. Of course you add other files and check for duplicate entries >>> etc. but that would be how I would do it. >>> >>> Hope that helps. >>> >>> CreateWindow >>> http://justpageprobe.com >>> The FREE Web page scan utility you always wanted. >>> Keep your router connected. >>> Email your IP to where you need it. >>> Monitor your enterprise Web Servers. >>> >>> >>> >>> >>> "Brennan" <Bren***@discussions.microsoft.com> wrote in message >>> news:E95CD450-FD53-4033-ACB7-2592DAC44FFB@microsoft.com... >>>> We are trying to come up with a way to delete files based on how long >>>> they >>>> have lived in a folder. In our case our FTP server. With so many of the >>>> scripts being based on Creation Data, Modified or Last Accessed Date we >>>> havent been able to come across a script that would work for us because >>>> a >>>> user may tranfser a file to the FTP server and if the script is based >>>> on the >>>> creation date then in could be deleted the next day. If based on the >>>> Last >>>> Accessed date a user could constantly keep opening the file to keep it >>>> from >>>> being deleted. >>>> I have come across two potential attributes that may work, MaxAge and >>>> rentention Period but I havent been able to find out exactly what they >>>> are. >>>> >>>> Any ideas would be great!! >>>> >>>> >>> >>> >> >> > > You could try the robocopy /minage switch. Say you wanted to delete files
older than 90 days, you'd run this every night -->8 cut below here @ECHO OFF ROBOCOPY C:\InetPub\FTPROOT C:\SafetoDelete /e /w:0 /r:0 /minage:90 DEL C:\SafetoDelete\*.* /S /Q -->8 copy above here This will work on the last modified date. Cheers, Jeremy. Show quote "Brennan" <Bren***@discussions.microsoft.com> wrote in message news:E95CD450-FD53-4033-ACB7-2592DAC44FFB@microsoft.com... > We are trying to come up with a way to delete files based on how long they > have lived in a folder. In our case our FTP server. With so many of the > scripts being based on Creation Data, Modified or Last Accessed Date we > havent been able to come across a script that would work for us because a > user may tranfser a file to the FTP server and if the script is based on > the > creation date then in could be deleted the next day. If based on the Last > Accessed date a user could constantly keep opening the file to keep it > from > being deleted. > I have come across two potential attributes that may work, MaxAge and > rentention Period but I havent been able to find out exactly what they > are. > > Any ideas would be great!! > > |
|||||||||||||||||||||||