Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy files by date
Message
 
 
To
28/12/2002 10:30:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00736270
Message ID:
00736290
Views:
13
Jos,

It's better to store path into variable and use that variable in the code. If path changes, you'll have to change only one line of code. See my code in this thread for example.

>
>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
>
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform