SCP and changing filename

  • Follow


Hi,

Now I copy the file named mybackup to a remote site by:

scp /tmp/mybackup myuser@server4:/share3/folder1

However I need to rename the file in the process, so it works like this:

scp /tmp/mybackup myuser@server4:/share3/folder1/mybackup-$weekday

Due to various reasons I cannot rename the file before scp'ing it.

How do I achieve this?

regards geir
0
Reply geir02 (29) 12/4/2009 2:15:13 PM

Geir wrote:
> Hi,
> 
> Now I copy the file named mybackup to a remote site by:
> 
> scp /tmp/mybackup myuser@server4:/share3/folder1
> 
> However I need to rename the file in the process, so it works like this:
> 
> scp /tmp/mybackup myuser@server4:/share3/folder1/mybackup-$weekday
> 
> Due to various reasons I cannot rename the file before scp'ing it.
> 
> How do I achieve this?

The command you gave should work as is.  What kind of problem are you 
encountering?
0
Reply Don 12/4/2009 2:35:49 PM


On 2009-12-04, Geir <geir02@gmail.com> wrote:
> Hi,
>
> Now I copy the file named mybackup to a remote site by:
>
> scp /tmp/mybackup myuser@server4:/share3/folder1
>
> However I need to rename the file in the process, so it works like this:
>
> scp /tmp/mybackup myuser@server4:/share3/folder1/mybackup-$weekday
>
> Due to various reasons I cannot rename the file before scp'ing it.
>
> How do I achieve this?
>
> regards geir

Exactly as you state. 

0
Reply unruh 12/4/2009 6:29:17 PM

Don Piven skreiv:
> Geir wrote:
>> Hi,
>>
>> Now I copy the file named mybackup to a remote site by:
>>
>> scp /tmp/mybackup myuser@server4:/share3/folder1
>>
>> However I need to rename the file in the process, so it works like this:
>>
>> scp /tmp/mybackup myuser@server4:/share3/folder1/mybackup-$weekday
>>
>> Due to various reasons I cannot rename the file before scp'ing it.
>>
>> How do I achieve this?
> 
> The command you gave should work as is.  What kind of problem are you 
> encountering?

The target full name was a mix of strings and variables - with a double 
slash in its result.  Sorry for bothering this time.

geir
0
Reply Geir 12/5/2009 12:25:28 AM

Geir Holmavatn wrote:

> Don Piven skreiv:
>> Geir wrote:
>>> Hi,
>>>
>>> Now I copy the file named mybackup to a remote site by:
>>>
>>> scp /tmp/mybackup myuser@server4:/share3/folder1
>>>
>>> However I need to rename the file in the process, so it works like
>>> this:
>>>
>>> scp /tmp/mybackup myuser@server4:/share3/folder1/mybackup-$weekday
>>>
>>> Due to various reasons I cannot rename the file before scp'ing it.
>>>
>>> How do I achieve this?
>> 
>> The command you gave should work as is.  What kind of problem are you
>> encountering?
> 
> The target full name was a mix of strings and variables - with a
> double
> slash in its result.  Sorry for bothering this time.
> 
> geir

Sounds like you need to parse the data that is being assigned to the
$weekday variable.
-- 
Not really a wanna-be, but I don't know everything.
0
Reply Wanna 12/5/2009 3:03:46 AM

4 Replies
999 Views

(page loaded in 0.096 seconds)

Similiar Articles:








7/21/2012 7:42:48 PM


Reply: