Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a script on a remote server that creates a log each day with the date on the name and need to import it to my local machine everyday, but with my script it transfers all the files and I just want the file of the day.

Remote script that generates the file:

day=`date +%Y_%m_%d`

file=daily_$day\.txt

.
.
. >> $file

Local script to get the files:

day=`date +%Y_%m_%d`

file=daily_$day.txt
report=/path/to/remote

scp user@remote.ip:$report\/$file /path/of/local/

Today date is 2013_05_23 and this is what i get:

daily_2013_05_22 100%********************************|  1784       00:00

daily_2013_05_23 100%********************************|  1784       00:00

It should return only the file with the 2013_05_23 on the name.

Can anyone help?

Tkx

share|improve this question

1 Answer 1

Your script looks ok to me, except for the \/$file.

Why the backslash? Get rid of it:

scp user@remote.ip:$report/$file /path/of/local/
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.