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]
[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
[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
liked Script FTP? Try our other product Email Parser