Page 2 of 2 <12
Topic Options
#59372 - 2001-10-02 09:43 PM Re: delete files/folders according to their time stamp...
Anonymous
Unregistered


Or...you could just break down and use a shareware command to do this.

xxcopy, for example, is very cheap and fast.

Here is a command that would clean out the old files and folders.

xxcopy \\ftpserver\ftproot\*.* /rs /s /pd0 /y /db#60
http://www.xxcopy.com/xxcopy

Top
#59373 - 2001-10-02 11:15 PM Re: delete files/folders according to their time stamp...
Anonymous
Unregistered


Hey mark thats what I'm looking for! Thanks for the help everyone, much appreciated This is a board full of talented people... If we could add more RAM in our brain, this is the first place I'd shop
Top
#59374 - 2001-10-16 04:33 AM Re: delete files/folders according to their time stamp...
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Another idea for deleting old files with exclusion values which runs on
kixtart 3.6x and 4.x versions.
See topic
http://kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=1&t=002516
Of course the xxcopy is an excellent tool.
Greetings.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#59375 - 2001-12-04 03:19 PM Re: delete files/folders according to their time stamp...
Anonymous
Unregistered


To keep it simple...
This might work?
===========================================

; Tempty.kix
; Empty the %temp% folder (delete all files older than '$keepdays' days)
; Version 1.00

break on

; init
$tmpdir = ExpandEnvironmentVars("%temp%")
if (substr($tmpdir, len($tmpdir), 1) = "\")
$tmpdir = substr($tmpdir, 1, len($tmpdir) - 1)
endif
$monthdays = 31,28,31,30,31,30,31,31,30,31,30,31
$keepdays = 15

; calculate today's serial date
$curyear = val(@year) - 2000
$curmonth = val(@monthno) - 1
$curday = val(@mdayno)
$curdate = 365 * $curyear
for $dummy = 0 to $curmonth - 1
$curdate = $curdate + $monthdays[$dummy]
next $dummy
$curdate = $curdate + $curday ; number of days since 01/01/2000

; dir files in %temp% dir
$myfile = dir($tmpdir)
while $myfile <> "" and @error = 0
if exist("$tmpdir\$myfile\") = 0
; calculate file's serial date
$myfiledate = GetFileTime("$tmpdir\$myfile")
if $myfiledate = ""
$filedate = $curdate
else
$fileyear = val(substr($myfiledate, 1, 4)) - 2000
if $fileyear < 0
$fileyear = 0
endif
$filemonth = val(substr($myfiledate, 6, 2)) - 1
$fileday = val(substr($myfiledate, 9, 2))
$filedate = 365 * $fileyear
for $dummy = 0 to $filemonth - 1
$filedate = $filedate + $monthdays[$dummy]
next $dummy
$filedate = $filedate + $fileday ; number of days since 01/01/2000
endif
; delete file if older than $keepdays days
if $filedate < $curdate - $keepdays
del "$tmpdir\$myfile"
endif
endif
$myfile = dir()
loop

; end script
:the_end
; That's All, Folks!

===========================================

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 533 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.051 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org