ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
I'm having trouble with the SYNC syntax - it will not recognize my local directory. I've tried variations of double and single quotes, as well as making the directory a variable, but still no luck. Can someone help me see what I'm missing? Please note the EXEC commands are working fine, so I know the directory does exist.
Code: Select allOPENHOST("xxx.xxx.xxx.xxx","xx","xx") $slipsheets='d:\hmedocs\slip sheets\*.dnc' $eobs='d:\hmedocs\eobs and deposits\*.dnc' SYNC("$slipsheets","/slip sheets",UPLOAD) SYNC("$eobs","/eobs and deposits",UPLOAD) EXEC ('move "d:\hmedocs\slip sheets\*.dnc" "d:\hmedocs\sent files\slip sheets\"') EXEC ('move "d:\hmedocs\eobs and deposits\*.dnc" "d:\hmedocs\sent files\eobs and deposits\"') # Transfer finished, close the connection CLOSEHOST
Have you tried this?
Code: Select allSYNC($slipsheets,"/slip sheets",UPLOAD) SYNC($eobs,"/eobs and deposits",UPLOAD)
The variables do not go enclosed in " or '. They just start with the character $.
Just gave it a try - same error. SYNC ERROR #123
Hi Keni,

Is it a syntax error or a SYNC error? If ScriptFTP does not execute any commands at all it's a syntax error.
Please, post here the script output (copy and paste here form the ScriptFTP window) and the complete sript that causes the error.
Here is the script that I have written:
Code: Select allOPENHOST("xxx.xxx.xxx.xxx","xx","xx") # Send all the files and subdirectories in C:\MyDir to the server $slipsheets='d:\hmedocs\slip sheets\*.dnc' $eobs='d:\hmedocs\eobs and deposits\*.dnc' SYNC($slipsheets,"/slip sheets",UPLOAD) SYNC($eobs,"/eobs and deposits",UPLOAD) EXEC ('move "d:\hmedocs\slip sheets\*.dnc" "d:\hmedocs\sent files\slip sheets\"') EXEC ('move "d:\hmedocs\eobs and deposits\*.dnc" "d:\hmedocs\sent files\eobs and deposits\"') # Transfer finished, close the connection CLOSEHOST
And here is the result when I run the script. You can see there is one file in the D:\hmedocs\eobs and deposits directory, and it move that file later in the script, but for the SYNC command, it cannot find that same directory.

Running D:\HMEDOCS\hmedocsupload.ftp

OPENHOST("xxx.xxx.xxx.xxx","xx",xx)
Connecting to 209.235.104.238
Connected.

SYNC("d:\hmedocs\slip sheets\*.dnc","/slip sheets",UPLOAD)

***** SYNC Error #123 : Cannot change current local directory to d:\hmedocs\slip sheets\*.dnc.
***** The system said: The filename, directory name, or volume label syntax is incorrect.



SYNC("d:\hmedocs\eobs and deposits\*.dnc","/eobs and deposits",UPLOAD)
***** SYNC Error #123 : Cannot change current local directory to d:\hmedocs\eobs and deposits\*.dnc.
***** The system said: The filename, directory name, or volume label syntax is incorrect.



EXEC("move "d:\hmedocs\slip sheets\*.dnc" "d:\hmedocs\sent files\slip sheets\"")
A duplicate file name exists, or the file
cannot be found.

EXEC("move "d:\hmedocs\eobs and deposits\*.dnc" "d:\hmedocs\sent files\eobs and deposits\"")
d:\hmedocs\eobs and deposits\M-CAL 9-15-08-7 00.00.dnc

CLOSEHOST
Disconnected.
Code: Select all# wrong SYNC("d:\hmedocs\eobs and deposits\*.dnc","/eobs and deposits",UPLOAD)
This is the correct way:
Code: Select all# right SYNC("d:\hmedocs\eobs and deposits","/eobs and deposits",UPLOAD,"*.dnc")

The first parameter must be a local directory and "d:\hmedocs\eobs and deposits\*.dnc" is not a valid directory name beacuse of the trailing "*.dnc". If you want to use wildcards you have to use the appropiate SYNC parameter, mixing wildcards with the local directory name is not understood by SYNC.

Take a look at http://www.scriptftp.com/reference.php?go=topic520 for detailed information about the SYNC command. There is an example of using SYNC with wildcards, it's the last one. But feel free to post here again if you still have problems.
Works perfectly now - thank you!