Shell Script to monitor folder and upload found files via FTP
Hi everyone!
I'm in a need of a shell script that search for all files in a folder, move all those files to a temp folder, and upload those files via FTP. When the file transfer via FTP completes successfully, the file is moved to a completed folder. In case any of those files fails, the file will be moved to a failed folder.
I have very little knowledge on Shell Scripting, but I'll try to explain as clear as possible what I need using a example flow below.
The script will work with these steps:
For each file with extension $FILE_EXT in $MONITOR_DIR
echo "found file: " and the name(s) of file(s) found
Move all found files to $TMP_DIR/$PROCCESS_ID_DIR (folder $PROCCESS_ID_DIR has to be created)
For each file in $TMP_DIR/$PROCCESS_ID_DIR
Upload via FTP each file individually using the FTP variables
If FTP transfer completes, move that file to $SUCCESS_DIR, else move it to $FAILED_DIR
echo "file (file_name) transfered" or "file (file_name) failed" depending on what happened above
When all the files in $TMP_DIR/$PROCCESS_ID_DIR are processed, delete $PROCCESS_ID_DIR folder in $TMP_DIR
quit script
That's basically it. I need this to monitor/backup/copy-to-CDN files uploaded to my site using a cron file.
Any help will be greatly appreciated...
Thanks!
---------- Post updated 07-24-10 at 12:19 AM ---------- Previous update was 07-23-10 at 10:04 AM ----------
Created this script
It does the work...
Any recommendations?
Last edited by pulsorock; 07-23-2010 at 11:20 AM..
Hi!
I'd like to upload a complete folder with subfolders with put. At the moment I always get the err-msg:
aboutme: not a plain file
Could anyone help me??
Thanx (3 Replies)
Hi,
I am having an ftp script(runs in HP unix server) that connect to another server where we have different folders named as email addresses(eg."anarayana@yahoo.com").
Then it goes to each folder and put the file in that folder.
I found an error when remote folder is not created.
"550... (1 Reply)
Hello,
We have been having some issues with our users overwriting files, and then not having a backup. What I would love to do, is create a shell script to monitor /tmp, for uploads, and make a copy of the file they are trying to upload before the upload finishes.
Is this possible at all? (6 Replies)
Hi
I'm having some trouble with a bash shell script that I'm writing. In the script, I'm trying to upload a file to a backup repository using ftp, but the whole file doesn't get uploaded.
This is the file's properties at the start (I've highlighted the file size in red):
-rw-r--r-- 1 root... (2 Replies)
Hi
Before Posting my query in this forum, I have gone through various similar postings to get some idea on ftp and how to do that from unix shell script to windows server.
My question is related to FTP'ing from Unix to windows shared folder
My basic question is
1. Is it possible to do FTP... (4 Replies)
hi
please help me out here,
i want to use curl command in shell script to test web pages,
what i have is an opening page, when i click on a button on opening page, the next page comes up and then i have to upload a file n then click another button to submit and then comes the output page,... (2 Replies)
Hi,
Im a newbie with programming and shell scripting. Im running OSX/Mac and Darwin.
I would like to create a shell script that would :
1. Search a Volume and directory (including subdirectories) for a file that :
* filename ends with ”_Highres.pdf” and
* the file creation date of... (8 Replies)
Hello,
I have 3 folders on FTP server in the format yyyymmddhhmiss as below,ftp> cd /home/walgreens
250 CWD command successful
ftp> ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
20150708072901
20150708092901
20150708102901The above folders are in... (1 Reply)
Hi Experts,
I am not good in writing script. Just stared. I am looking for shell script to check following parameters.
1) Number of files on remote Linux SUSE server.- Any directory and sub directory.
2) I should define number of files in script. Files should be variable.
3) Age of the... (2 Replies)
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)