Just to inquire, how will ScriptFTP handle the files if there is a file with the same name?
For example, using the GETLIST / FOREACH and GETFILE combination, b4 i GETFILE the files from the FTP server, i would like to check if my target directory has the same filename. If the filename exist, to rename the file and save to target.
Is this workable?
For example, using the GETLIST / FOREACH and GETFILE combination, b4 i GETFILE the files from the FTP server, i would like to check if my target directory has the same filename. If the filename exist, to rename the file and save to target.
Is this workable?
Hello,
Yes, it can be done using the FOREACH command. Take a look at this example I've written for you:cc
Yes, it can be done using the FOREACH command. Take a look at this example I've written for you:cc
FTP Script
- # Settings
- $ftpserver="127.0.0.1"
- $ftpuser="carl"
- $password="123456"
- # The files will be downloaded here
- $downloaded_files_directory="D:\downloaded_files"
- # For each file downloaded we check first if we
- # already have a file with the same name in the
- # local directory $downloaded_files_directory
- # If it happens the local file is moved to
- # this directory:
- $target_directory="D:\target"
- # Connect to FTP server
- # Change current local directory
- # Retrieve the remote file listing and store it in $remote_file_list
- # Retrieve the local file listing and store it in $local_file_list
- # For each element in the file list do the following
- # Check if the remote file already exists
- # in the local directory
- $exists="FALSE"
- $exists="TRUE"
- # If it already exists move the file to
- # the target directory and append the time
- # to the file name.
- # Download the file
- # Close the connection with the FTP server
liked Script FTP? Try our other product Email Parser
Thanks a lot