I need a robust shell script fast and don't have time to learn how script it myself from scratch.
An existing PHP Application allows consumers to place an order for a product and upload files necessary to build that product. These files are stored in folders on the webserver with a unique name that matches the order number, (eg. 10015, 10016, 10017, etc). I need to create a shell script that can monitor this upload directory and when a new order is received it should zip up the files, ftp them to a remote server, and clean up the source files. See details below.
FYI: I have a working model using PHP to zip, ftp, & clean up the files but it requires the user's PHP session to remain active throughout the entire process. Since the zip files can potentially be very large it's not very practical or convenient to make the user wait for the zip/ftp/cleanup process to take place.
1. Browse to a certain directory on the server which contains folders. Each folder has a unique number as it's name (eg. 10015, 10016, 10017, etc) and each folder contains one or more files. The first objective is to create a single zip archive with all the files from one of the folders (preserving the folder structure of subfolders).
2. Make sure the zip file is valid and then delete the source folder and it's files.
3. Open an FTP connection to a remote server and send the zip file to the remote server.
4. Make sure the file transmitted successfully and then delete the source file form the local server.
5. Automate the task using a Fedora Linux compatible cron tab.
I am willing to pay for this script via Paypal. Please let me know how much it would cost and what the turn around time would be.