Link to home
Start Free TrialLog in
Avatar of cgarreta
cgarretaFlag for Spain

asked on

Uploading files with LFTP by date

Every day my web server generates a series of files with the following format:
AA-BB-YYYYMMDD.txt. For example: CA-FR-20101119.txt

The generated files are being stored in a directory. Until now, I synchronize it with the remote server using mput -c, uploading any files that have changed. However, the files in the remote server are moved once uploaded, so each day the script upload all the files back again.

I need to upload (syncronize) only the current day files, but for the date in the filename.

I am using the following script:

#!/bin/sh
USERNAME="username"
PASSWORD="password"
SERVER="10.10.10.10"

# local directory to pickup files
FILES="/var/www/html/CA-*.txt"

# remote server directory to upload files
UPLOADIR="/destination"

# login to remote server
lftp -u ${USERNAME},${PASSWORD} ${SERVER} << CMD
cd ${UPLOADIR}
mput -c ${FILES}
bye

Thank you very much for your help.
Avatar of cgarreta
cgarreta
Flag of Spain image

ASKER

One way to simplify the question will be... Can I synchronize with the remote server only the current day files?
I don't know if it is possible using a LFTP command.
Thank you.
Thanks Jon. Could you delete this post or move it to the correct zone?
ASKER CERTIFIED SOLUTION
Avatar of cgarreta
cgarreta
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of The--Captain
Can you post your exact solution for others to read?

Thanks,
-Jon