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.
Post here if you experience file transfer problems or unexpected errors.
I am using the sync command to download some directories and the script is working fine. The question I have is how can I get it to automatically delete the laptop/ folder and its contents if it it is already in place i.e. donone\laptop is already on my hard drive. Is there a way to tell the addexclusion to delete what it is excluding from the target directory? Awesome program by the way!

Thanks

[scriptftp="donone_sync1.txt"]# Connect to FTP server
VERBOSE(ON)
LOGTO("G:\FTP_Logs\donone_log.txt")
OPENHOST("moa777333777","jfalsmaonvoa","888888888777")
ADDEXCLUSION(DOWNLOAD,"laptop/")
ADDEXCLUSION(DOWNLOAD,"Flash 8 Tutorials/")
ADDEXCLUSION (DOWNLOAD,"*.psd")
ADDEXCLUSION (DOWNLOAD,"*.pdf")
SYNC("G:\WinSCP_Test\donone\","/public_html/donone/",DOWNLOAD_DELETE,SUBDIRS)
CLOSEHOST[/ScriptFTP]
Is there a way to tell the addexclusion to delete what it is excluding from the target directory?
Just to be sure. What do you mean with the target directory? The one in your hard drive or the other in the FTP server?
The in my hard drive.
It is a workaround, may be it works for you. You can check if G:\WinSCP_Test\donone\laptop exists, if so, delete the directory:

[scriptftp="delete_local_directory.ftp"]# retrieve the directory listing of G:WinSCP_Test
LOCALCHDIR("G:\WinSCP_Test\")
GETLIST($list,REMOTE_DIRECTORIES)

# Check if the dir "laptop" exists

$found="FALSE"
FOREACH $dir in $list
IF($dir=="laptop")
$found="TRUE"
END IF
END FOREACH

# Delete the directory G:\WinSCP_Test\laptop
IF($found)
EXEC("rd /s /q G:\WinSCP_Test\laptop")
END IF[/ScriptFTP]