scp +find


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users scp +find
# 1  
Old 11-09-2006
Question scp +find

I'm trying to backup some log files (older than 15 days) from a remote server using scp.
I usued:
scp me@remote_machine:`find folder/*.log -mtime +15` .
but don't works!

Someone can help me?
Thanks.
Smilie

Last edited by Minguccio75; 11-10-2006 at 06:58 AM..
# 2  
Old 11-10-2006
Are you expecting that find to be executed on the machine you're connecting to? It won't be. To use shell commands on a remote host, use ssh.
# 3  
Old 11-10-2006
Thanks Corona688...
can you give me the right commands?
# 4  
Old 11-10-2006
Code:
ssh me@remote_machine:"find folder/*.log -mtime +15" > /tmp/remote_list
while read filename; do
   echo "get $filename" >> /tmp/batch
done < /tmp/remote_list
echo "bye" >> /tmp/batch
sftp -b /tmp/batch me@remote_machine

Not tested at all! Please test before using in production (if any).
# 5  
Old 11-13-2006
scp

just for future reference, use scp to copy files to and from remote areas.
# 6  
Old 11-13-2006
Quote:
Originally Posted by Sowser
just for future reference, use scp to copy files to and from remote areas.
I agree, but from the OP's first post, it looks like there might be multiple files, and scp might have to be run several times. Since each time scp is run it will have to setup the connection and then release it, an sftp might be better in this case.
# 7  
Old 11-13-2006
scp

really? i could have sworn you could scp with '*'. yes in fact i recall now, you can scp multiple files...something like this if i recall correctly...

scp root@testbox:/var/tmp/mydir/* .

this would connect once and ask for password and then its copy away....i really should test this before i post, but i am not at work right now.

But to put some logic in there for the older than 15 days, cant be done with scp as far as i know.

-Sowser
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ssh find and scp

Hello All, I have a requirement to copy few files from remote server to local, and below are the sequence ssh to the remote host finding the files with the specific condition once found scp to the local server path for (( i=0; i<${tLen}; i++ )) do ssh... (1 Reply)
Discussion started by: nextStep
1 Replies

2. 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

3. 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

4. Shell Programming and Scripting

find -exec scp

Hello, I'm facing a problem with a command that works on Linux but not on Unix (Solaris 10). I want to find files and scp then to another server. This command is: find /path -type f -exec scp {} root@node000C76211737:{} \; All the files are found correctly but it looks like the last... (7 Replies)
Discussion started by: Tex-Twil
7 Replies

5. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 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

9. UNIX for Dummies Questions & Answers

scp

How do i use scp to copy a file from my home directory on a server I am logged into, to the computer I am using? I thought it would be something like: scp filename mycomp.company.org Thanks. (2 Replies)
Discussion started by: ignus7
2 Replies
Login or Register to Ask a Question