#136564 - 2005-03-28 09:35 PM
not deleting file- why?
|
annie
Fresh Scripter
Registered: 2002-02-12
Posts: 10
|
Would someone be so kind as to look at this code and tell me why the files that are older than 3 days are not getting deleted? basically, I have to read the contents of a directory which will contain about 100 files over a span of several days. if the file is > 3 days old, get rid of it (so I don't hog space). It runs, and displays the file name correctly, but nothing seems to be happening, not sure whether it's the datecalc or my logic that's screwed up.
$date1 = @date
call "\\servername\scripts\DateCalc.udf"
C1 $filename1 = DIR("\\server\adlogs\log_dc1") WHILE $filename1 <> "" and @error = 0 $file = "\\server\adlogs\log_dc1\$filename1" ;comparing the date (if file is 3 days older than todays date, get rid of it) if DateCalc(@date,left(getfiletime($file),10)) > 3 ? $file "will be deleted" del $file endif DIR() ;retrieve next file LOOP return
exit
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1538 anonymous users online.
|
|
|