I have about 500 remote dirs that I would like to perform an action on immediately (or at least very soon) when a new upload to that dir is detected. Is there such a "listen" script?
My goal is to move a file (or rename to a different location) as soon as it's uploaded?
Any suggestions would be helpful.
My goal is to move a file (or rename to a different location) as soon as it's uploaded?
Any suggestions would be helpful.
Hi Tim,
I have modified the script of this other forum topic:
Upload a file as soon as it appears
http://www.scriptftp.com/forum/general-f6/upload-a-file-as-soon-as-it-appears-t520.html
to do the opposite, as you suggested. Instead of watching new file in a local directory it checks for it in the FTP side.
I have modified the script of this other forum topic:
Upload a file as soon as it appears
http://www.scriptftp.com/forum/general-f6/upload-a-file-as-soon-as-it-appears-t520.html
to do the opposite, as you suggested. Instead of watching new file in a local directory it checks for it in the FTP side.
FTP Script
- # This scripts checks if there is a new file in a set
- # of remote directories and as soon as the file appears
- # it moves it to another remote directory.
- # It is meant to be run periodically so this way it can
- # "watch" for incoming files in the FTP site.
- # Note that, if the file is being uploaded at the precise moment
- # this script runs, the action of moving the file to the destination
- # folder will fail but it will work on the next run if the upload
- # has finished.
- # The remote directories to watch for incoming files.
- # Use | to separate them
- $incoming_dirs="/my_dir_1|/my_dir_2|/my_dir_2/subdir1"
- # Once a new uplad is detected, the file is moved here
- $processed_files_dir="/my_destination_dir"
- # Connect to the FTP server
- # Change current remote directory
- # If CHDIR failed stop the script
- # Retrieve the list of files
- # If GETLIST failed stop the script
- # Move all the found remote files to processed
- # files dir
- # For moving files in FTP we need to actually rename it
liked Script FTP? Try our other product Email Parser