• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1108
  • Last Modified:

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.
0
cgarreta
Asked:
cgarreta
  • 3
1 Solution
 
cgarretaAuthor Commented:
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.
0
 
cgarretaAuthor Commented:
Thanks Jon. Could you delete this post or move it to the correct zone?
0
 
cgarretaAuthor Commented:
Thank you. Finally I solve the problem moving the old files to another directory and sincronizing only the current day files.
0
 
The--CaptainCommented:
Can you post your exact solution for others to read?

Thanks,
-Jon
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now