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:
00736288
Views:
11
Sergey and Jos,

Thanks for your help!

>Terry
>
>Assuming your files are in folder C:\FOLDER1...
>
>
>*!* Create an array of files to process
>
>nFiles = ADIR( aMyFiles, "C:\FOLDER1\*.TXT" )
>
>FOR i = 1 TO nFiles && Process each file in array
>
> *!* DO CASE is one option only. Could also use IF..ENDIF
> *!* I am trying to show you a structure for processing
> *!* based on various possible conditions.
>
> DO CASE
> CASE aMyFiles[ i, 3 ] > DATE()-5 && See if file date is less than 5 days old
>
> *!* Copy the file to new location
> COPY FILE ( "C:\FOLDER1\" + aMyFiles[ I, 1 ] ) TO ( "C:\FOLDER2\" + aMyFiles[ I, 1 ] )
>
> CASE aMyFiles[ i, 3 ] <= DATE()-5 && See if file date is more than 5 days old
>
> *!* Delete the file
> DELETE FILE ( "C:\FOLDER1\" + aMyFiles[ I, 1 ] )
>
> ENDIF
>
>NEXT && Process next file in array
>
>
>Jos
>
>
>>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,
>>
Thanks,

TFISHER
Previous
Reply
Map
View

Click here to load this message in the networking platform