Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy files by date
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00736270
Message ID:
00736285
Views:
11
lcFromDir = < ... >
lcToDir = < ... >
DIMENSION laFileLIst
lnFileCount = ADIR(laFileLIst, lcFromDir + "*.txt")
FOR i=1 TO lnFileCount 
  DO CASE
  CASE (laFileLIst[i,3] - DATE()) > 5
     ERASE (lcFromDir + laFileLIst[1])
  CASE (laFileLIst[i,3] - DATE()) <= 3
     COPY FILE (lcFromDir + laFileLIst[i,1]) TO (lcToDir + laFileLIst[i,1])
  ENDCASE
ENDFOR
>Hi Jos,
>
>Thanks for the reply.
>
>I need to copy certain files from one directory to another directory, then, I need to be able to delete files from a directory with dates older than 5 days. I am not sure that I see how ADIR() helps me do this.
>If possible, could you please elaborate?
>
>Thanks,
>
>>Terry
>>
>>ADIR() will fill an array with filenames matching a file skeleton (eg *.TXT) and store file details including date and time in the array.
>>
>>You can then go through this array in a FOR...NEXT loop and check file dates and process accordingly.
>>
>>Jos
>>
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform