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?
Hi,
Been using ScriptFTP for years now! Great product! /gives pat on the back

2 questions!

1. How do I sync to the current directory of my ftp server? I.E I don't want to specify a directory name just sync from a specified local directory to the current remote directory that I'm in once the FTP connects to the server?

2. Im using the script on this page as a template:

http://www.scriptftp.com/examples.php?go=send_email.ftp

and this code appears towards the bottom. Is the second parameter of SYNC correct? I thought it should be sync($local_dir,$remote_dir,UPLOAD)?
Code: Select all# Synchronize the files $result=SYNC([b]$remote_dir_to_synchronize,$remote_dir_to_synchronize[/b],UPLOAD) IF($result!="OK") PRINT("Cannot syncronize. Sending an email and aborting in 5 seconds.") EXEC($blat_cmd_line_2) SLEEP(5) EXIT(2) END IF CLOSEHOST  
Thanks!
Steve
Hi Steve,
Great product! /gives pat on the back
:)
1. How do I sync to the current directory of my ftp server?
Retrieving the current remote directory with CWDIR:
http://www.scriptftp.com/reference.php?go=topic130

and then using it in SYNC. For example:
Code: Select all$current_remote_dir=CWDIR() SYNC("C:\mylocaldir",$current_remote_dir,UPLOAD)

2 (...) Is the section in bold correct? (...)
Ops, it is a mistake. Fixed. Thanks!
Thanks for the help. It is much appreciated!

I followed your instruction but I'm now getting this error in my email thats sent to me:

SYNC("D:\Test\Data","",UPLOAD)

***** SYNC Error #550: Cannot change current remote directory to .
***** The server said: Failed to change directory.

Cannot syncronize. Sending an email and aborting in 5 seconds.

Heres some of my code:
Code: Select all$remote_dir_to_synchronize=CWDIR() $local_dir_to_synchronize="D:\Test\Data" $result=SYNC($local_dir_to_synchronize,$remote_dir_to_synchronize,UPLOAD)
When I connect to the ftp server I'm automatically in the root or top level which has no name. There are a few subfolders with names but I need to put the file in the root. Any ideas? I just really need to upload one file thats in my local directory to the ftp server.
When I connect to the ftp server I'm automatically in the root or top level which has no name. There are a few subfolders with names but I need to put the file in the root. Any ideas? I just really need to upload one file thats in my local directory to the ftp server.
This is a bit strange, your FTP server should have reported a remote directory, not nothing as it seems. Usually they report "/" just after connecting, this usually refers to the root folder of the FTP user.

To put the file in the root folder try:
Code: Select allSYNC("D:\Test\Data","/",UPLOAD)
If you want to see exactly what your FTP server is telling ScriptFTP activate verbose mode on the top of your script
Code: Select allVERBOSE(ON)
I'm particularly curious about the response to the FTP protocol CWD command that ScriptFTP sends to the server when the script command CWDIR is invoked.
The user have just contacted me confirming that the problem was solved. I quote the email from him below:
It turned out it was the people who maintain the ftp site had mis-configured it, which was why it wasn\'t returning the directory! It's all sorted now.