Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Windows Server » microsoft.public.windows.server.scripting
Thread: Delete Files Based On Date

HTVi
TV Discussion Newsgroups

Delete Files Based On Date
Brennan 5/2/2007 8:31:01 PM
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!!


Re: Delete Files Based On Date
"CreateWindow" <createwindow[ at ]gmail.com> 5/3/2007 1:58:04 AM
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" <Brennan[ at ]discussions.microsoft.com> wrote in message
news:E95CD450-FD53-4033-ACB7-2592DAC44FFB[ at ]microsoft.com...
[Quoted Text]
> 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!!
>
>


Re: Delete Files Based On Date
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 5/5/2007 1:24:29 PM
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" <createwindow[ at ]gmail.com> wrote in message
news:SKydnTfXx8Aj3KTbnZ2dnUVZ_qmdnZ2d[ at ]giganews.com...
[Quoted Text]
> 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" <Brennan[ at ]discussions.microsoft.com> wrote in message
> news:E95CD450-FD53-4033-ACB7-2592DAC44FFB[ at ]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!!
>>
>>
>
>


Re: Delete Files Based On Date
"CreateWindow" <createwindow[ at ]gmail.com> 5/5/2007 11:17:42 PM
Hi Al,

Good point!

( I just took the below from Brennan to mean that "updates" were rare or
naughty in some way. )

[Quoted Text]
>> Accessed date a user could constantly keep opening the file to keep it
>> from
>> being deleted.

CreateWindow


"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
news:umSaSezjHHA.4248[ at ]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" <createwindow[ at ]gmail.com> wrote in message
> news:SKydnTfXx8Aj3KTbnZ2dnUVZ_qmdnZ2d[ at ]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" <Brennan[ at ]discussions.microsoft.com> wrote in message
>> news:E95CD450-FD53-4033-ACB7-2592DAC44FFB[ at ]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!!
>>>
>>>
>>
>>
>
>


Re: Delete Files Based On Date
"Al Dunbar" <AlanDrub[ at ]hotmail.com.nospaam> 5/5/2007 11:24:49 PM
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

"CreateWindow" <createwindow[ at ]gmail.com> wrote in message
news:2_OdnSHCX-0DjaDbnZ2dnUVZ_qGdnZ2d[ at ]giganews.com...
[Quoted Text]
> 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" <AlanDrub[ at ]hotmail.com.nospaam> wrote in message
> news:umSaSezjHHA.4248[ at ]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" <createwindow[ at ]gmail.com> wrote in message
>> news:SKydnTfXx8Aj3KTbnZ2dnUVZ_qmdnZ2d[ at ]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" <Brennan[ at ]discussions.microsoft.com> wrote in message
>>> news:E95CD450-FD53-4033-ACB7-2592DAC44FFB[ at ]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!!
>>>>
>>>>
>>>
>>>
>>
>>
>
>


Re: Delete Files Based On Date
"Jeremy" <jeremy[ at ]discussions.microsoft.com> 5/6/2007 6:07:57 AM
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
[ at ]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.

"Brennan" <Brennan[ at ]discussions.microsoft.com> wrote in message
news:E95CD450-FD53-4033-ACB7-2592DAC44FFB[ at ]microsoft.com...
[Quoted Text]
> 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!!
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen