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?
How do I apply the following ext. renaming script to all files in all sub directories rather than 1 directory.

[scriptftp="rename_subdirectories.ftp"]CHDIR("/gallery/albums/2001/Test")
# Rename all JPG files to jpg
RENAMEFILE("*.JPG","*.jpg")
CLOSEHOST[/ScriptFTP]
If there is only one level of subdirectories you can do the following:


[scriptftp="rename_in_subdirs.ftp"]GETLIST($subdir_list, REMOTE_DIRECTORIES)

FOREACH $subdir IN $subdir_list
# Go to that subdir
CHDIR($subdir)

# Rename all the files in that subdir
RENAMEFILE("*.JPG","*.jpg")

# Return to parent directory
CHDIR("..")
END FOREACH

CLOSEHOST()[/ScriptFTP]

You can also make it work in two levels of subdirectories nesting one FOREACH inside another FOREACH