Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copyfile/delfile don't work

Status
Not open for further replies.

ammco

Programmer
Oct 27, 2004
4
US
I am downloading the a1027a.ern file using ZModem to a mapped network drive X:\835_incoming\, which it does nicely, but I need to "move" the file to another directory X:\ADIR\ on the same networked drive.

What am I missing here? Copyfile and delfile don't work. Thanks for your gentle help!
ammco


;Call from main:
#define ADir "X:\ADIR\"
string sFilename = "a1027a.ern"
string szBBS = "ERA"

pCopyFile(szBBS, sFileName)
;---------------------------------------------------------
proc pCopyFile
param string sBBS
param string sSrcFile

string szMsg, sSource, sDestination
string sSrcDir = "X:\835_incoming\"
strfmt sSource "%s%s" sSrcDir sSrcFile

switch sBBS
case "ERA"
strfmt sDestination "%s%s" ADir sSrcFile
logit(sSource) ;X:\835_incoming\A1027A.ERN
logit(sDestination) ;X:\ADIR\A1027A.ERN

if findfirst sSource
strfmt szMsg "sSource is [%s]" sSource
logit(szMsg)
;sSource is [X:\835_incoming\A1027A.ERN]

if copyfile sSource sDestination
delfile sSource
else
strfmt szMsg "Could not copy [%s] to [%s]" sSource sDestination
logit(szMsg)
;Could not copy [X:\835_incoming\A1027A.ERN] to [X:\ADIR\A1027A.ERN]
endif
else
strfmt szMsg "did not find it"
logit(szMsg)
endif
endcase
endswitch
endproc
 
At first glance, everything looks OK to me. Do you have write access to X:\ADIR\ or does a write-only version of a1027a.ern already exist in that directory? I take it you've looked at the log files and the values for sSource and sDestination look good?


aspect@aspectscripting.com
 
The values of sSource and sDestination are commented in the code, but yes...everything looks like it should work. I am executing the if part that should be doing the delfile function, and I have write access to both directories (source and dest) as well -- is there something about using ZModem? Is there something I can configure in ProComm Plus? This should work...

Is copyfile case-sensitive (although I already tried that and it didn't work either)? Is there a way to step through the script and look at variables (I am new to Aspect)?

Thanks for another set of eyes.
ammco
 
I ran your script (as best I could) at work yesterday and it copied the file OK. Can you post the code that does the download of the file? I can look that over and see if the script is waiting until the download is complete before trying to copy the file.

You can add breakpoint commands to your script and then perform a debug compile to check on variables at different parts of the script, as well as step through it line by line. You can visit the below page for more detailed information on how to create a debug script and work in the debugger:


aspect@aspectscripting.com
 
I apologize for this: someone in IT changed the directory name on me and didn't tell me. This works just fine now.
Thank you so much for your time and suggestions.
Anna
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top