scp


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting scp
# 1  
Old 08-08-2007
scp

hi can any one pls tell me how to copy a file from a remote host to the same remote host with a timestamp, i need to use only scp.
thnks
# 2  
Old 08-08-2007
In scp syntax there isn't such option for time stamp, i mean, you cannot do "scp root@host:/file root@host:/new-path-to-file`date`" or something like that. Why not just login, rename the file and copy localy ? Maybe lack of shell ?
# 3  
Old 08-08-2007
scp

Quote:
Originally Posted by sysgate
In scp syntax there isn't such option for time stamp, i mean, you cannot do "scp root@host:/file root@host:/new-path-to-file`date`" or something like that. Why not just login, rename the file and copy localy ? Maybe lack of shell ?
hi this scp is a part of my main script, what it must do is to make a back up of the old file on the destination server with the timestamp,and then copy the new files frm the source server to the destination server.

thnks for the reply
# 4  
Old 08-08-2007
Locally you can generally do :
Code:
cp file-name new-file-name."`date`"

, but via scp you can't add timestamps in this manner, I just tried it on local machine, but it doesn't accept such kind of input.
# 5  
Old 08-08-2007
It looks like scp allows for variables, maybe you could set date as a variable?

$ /usr/bin/scp sourceID@sourceBOX:/home/sourceID/.forward /home/targetID/.forward-$TEST

.forward 100% 305 0.3KB/s 00:00

$ ls -la
total 64
drwx------ 4 targetID targetID 4096 Aug 8 12:01 .
drwxr-xr-x 37 root root 4096 Aug 3 13:57 ..
-rw------- 1 targetID targetID 816 Aug 8 11:45 .bash_history
-rw-r--r-- 1 targetID targetID 24 Aug 1 11:37 .bash_logout
-rw-r--r-- 1 targetID targetID 176 Aug 1 11:37 .bash_profile
-rw-r--r-- 1 targetID targetID 124 Aug 1 11:37 .bashrc
drwxrwxr-x 2 targetID targetID 4096 Aug 8 11:45 Crontab
-rw-r--r-- 1 targetID targetID 305 Aug 8 11:45 .forward
-rw-r--r-- 1 targetID targetID 305 Aug 8 12:01 .forward-test
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to use scp?

How to copy multiple directories using single command on solaris 10 from server A to server B. I tried scp but its working only one directory at atime How to acheive this with simple and short solution????? (6 Replies)
Discussion started by: buzzme
6 Replies

2. UNIX and Linux Applications

Need help with scp

Hi, I am trying to do scp from server A to server B. But while doing the scp i am getting the following message. +-----------------------------------------------------------------+ | This system is for the use of authorized users only. | | Individuals using this computer system... (6 Replies)
Discussion started by: sidh_arth85
6 Replies

3. Shell Programming and Scripting

SCP

Hi All, Please help on the below command scp -r 'directory name'inrvgo@IP:/export/home/muthu/prod_12-09-2010 I am trying to copy a directory from one server to another server using the above command but its displaing the error (missing destination file) but the diectory was there in the... (1 Reply)
Discussion started by: thelakbe
1 Replies

4. AIX

scp

1. how to move files in a directory using scp ? 2. how to move the entire directory ? 3. Will the file and the directory permissions affect scp usage? (1 Reply)
Discussion started by: samsungsamsung
1 Replies

5. Red Hat

scp with su

Hi Friends, I am trying to copy some files over the network in between my linux servers. I am using scp command for this. by default direct ssh root login is disabled on all of my linux servers. Normaly we used to login as a normal user and the su to th root user. unfortunately root user is... (1 Reply)
Discussion started by: arumon
1 Replies

6. Shell Programming and Scripting

Is this possible with SCP?

I normally download a directory recursively using: scp -r <name>@host:<path> . This has worked fine. As everyone knows this will download all of the directory named in <path> and all of the sub directories. I would like to know if it is possible to not download a particular file if it... (5 Replies)
Discussion started by: cpabrego
5 Replies

7. Shell Programming and Scripting

What is scp-ed over?

Hi all, i have a directory in server A. the directory path is /home/kevin. I need to scp the directory to another server B. i would like to ask, when i do a scp of the /home/kevin , i can expect all the files from A to go B. However, how about the hidden files? for example the ssh keys in the... (4 Replies)
Discussion started by: new2ss
4 Replies

8. UNIX for Advanced & Expert Users

Scp

I am trying to transfer a 10g files using scp, but I am getting timeout errors is there anywhere that I can modify a config file or something to increase the time. (4 Replies)
Discussion started by: rbizzell
4 Replies
Login or Register to Ask a Question