MarkL Posted January 9, 2018 Report Share Posted January 9, 2018 I have a macro that copies PDF file from one server to another. The problem I am having is that sometimes a PDF file is still being copied to the server when the macro run. 1. A document is scanned and saved as a PDF to server1 2. A macro runs every few minutes on server1 and copies the PDF to server2 3. Occasionally, at PDF is in the middle of being saved to server1 when the macro tries to move it to server2. This causes a window error or even a corrupt PDF file. Is there a way to tell is a PDF is ready to be moved? The "IF file Ready" command won't work because it only test Any ideas? Move file one-at-a-time.mxe Quote Link to comment Share on other sites More sharing options...
rberq Posted January 10, 2018 Report Share Posted January 10, 2018 Maybe have the macro check file date and time, and only attempt to copy those that are a few minutes old??? Those not old enough will presumably be processed the next time the macro runs. Command "Variable Set from File" can be used to obtain file information. Quote Link to comment Share on other sites More sharing options...
Samrae Posted January 11, 2018 Report Share Posted January 11, 2018 Try the Wait for File to be Ready command. If Folder Exists: "\\SCANSERVERHOST\PPLImageDepot\Processing Temp" Repeat with Folder C:\Scans // PLow thru the folder Clear Variables Variable Set From File path // Get teh file extension Variable Set From File: Set to the Size of a File (C:\Scans\%File%) If File Exists: "C:\Scans\%File%" If Variable %Size% Is Greater Than "0" Wait for File to be Ready: C:\Scans\%File% Copy File/Files: "C:\Scans\%File%" to "c:\Scans Sav" Move File/Files: "C:\Scans\%File%" to "\\SCANSERVERHOST\PPLImageDepot\Processing Temp\%File%" On Error Catch Error: File could not be located Macro Stop End Catch Error End Error End If End If End Repeat End If Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.