>Been digging in old foxpro code ( remember your article about ftp ?)
>
>A client of mine has a website. All the invoices have a code. With that code the customer can look at the details of the invoice. The detail of the invoice is kept for about a year.
>
>To do that I have a local mirror (which can be any level deep). Each morning I will add the new invoices to the mirror and delete the ones that are more than a year old
>
>I then sync a remote folder with the local folder
>
>Sync is done in a couple of steps
>(1) create blank cursor
>FileName M ( = relative file path to the local mirror / remote mirror)
>
>Local L, true if it exists locally
>IsFolder_Local
>Size_local I
>Time_local T
>
>Remote L (true if it exists remotely)
>IsFolder_Remote
>Size_remote
>Time_remote
>
>(2) Fill the cursor with the local files (to any depth)
>- FileName
>- Local true
>- size_local
>- time_local
>
>(3) Fill the cursor with the remote files
>Remote L (true)
>Size_remote
>Time_remote
>
>If the file alreay exists in the cursor, I fill out the fields
>otherwise, I append a record and fill out FileName + fields
>
>
>(4) Remove obsolete remote files
>- cursor is sorted in length of the filename DESCENDING ( so I process files before the conatining folder)
>
>for each record where ( !Local and Remote) or (IsFolder_Loal < > isFolder_Remote)
> delete remove file (or folder)
>
>(5) Sync local >> remote
>- cursor is sorted in length of the filename ASCENDING ( so i process folders before the files in them)
>
>for each record where ( local and (!remote or Time_local > Time_remote )
> make folder or tyransfer file
Thanks for elaboring the schema on this. It gives some great ideas.