ftp automation


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 a message here if you find anything wrong in ScriptFTP.

Here is problem I have with CWDIR() in 3.3

Here is my code:
Code: Select allIF($remote_directory!=$remote_target) PRINT("Remote directory is not target....") PRINT (" ") PRINT("Getting remote directory listing to find target....") PRINT (" ") GETLIST($remote_directory_list,REMOTE_DIRECTORIES) FOREACH $item IN $remote_directory_list IF ($item!=$remote_target) ELSE PRINT("Target found, moving to target....") PRINT (" ") CHDIR($item) $remote_directory2=CWDIR() PRINT("Remote is ".$remote_directory2." now.") END IF END FOREACH IF ($remote_directory2!="/SAP_Audit") PRINT("Target is not in current tree, exiting...") PRINT($remote_directory2) PRINT (" ") GOTO :failed_change_remote_dir END IF ELSE PRINT("Remote directory is target....") PRINT (" ") END IF
It would appear that is version 3.3 the CWDIR() does not return anything if the slash "/" is in the name of the remote directory name retrun by the ftp server. This was not the case in 3.2.

Strangely GETLIST($remote_directory_list,REMOTE_DIRECTORIES) will not return "/SAP_Audit" but "SAP_Audit".


Hi Zythan,

Yes, it is a bug. I will release a new ScriptFTP 3.3 build tomorrow that packs also some other fixes.

Thanks a lot for reporting that. The feedback from the users is very important to me, sometimes I am not able to check every single detail of ScriptFTP.
Hi there,

The new build of ScriptFTP version 3.3 with the fix is available at:


Any feedback is appreciated.

Sorry but this does not seem to solve the basic problem.

If I get the list of remote directories with GETLIST($remote_directory_list,REMOTE_DIRECTORIES) they are in "relative" form, but the CWDIR they are in "absolute" form:


GETLIST gives "data"
CWDIR gives "/data"

Therefore direct comparison between them is not possible, a work around must therefore be used:
Code: Select allIF ($remote_directory!="/".$remote_target)
Is the normal, or maybe I am not understanding something.


Yes, that is the normal behavior, it is not a bug. CWDIR returns absolute paths and GETLIST only returns directory names.

I thought that your problem was other because of your first post:
It would appear that is version 3.3 the CWDIR() does not return anything if the slash "/" is in the name of the remote directory name retrun by the ftp server
And in fact I found something weird in the implementation of the CWDIR in version 3.3.

Sorry for the confusion.

Thanks for the information about the absolute return from CWDIR.

My problem was that with version 3.2 CWDIR our scripts were designed to ajust for relative and absolute, when we upgraded our sandbox to 3.3 the scripts stop working, but this was not because of either relative or absolute but because of the CWDIR, to just took us time to work this out.

May I simply point out that in the documentation it is not clear that the CWDIR return absolute and since it states "If ScriptFTP is not connected to an FTP server it will return nothing", we were becoming confused as to where the problem was coming from.

But now things are clear and our script are working fine.

Very best regards.

Hi Zythan,

I have updated the CWDIR documentation accordingly and added another example. Thanks a lot for the feedback.