The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find a file named vijay in a directory using find command amirthraj_12 UNIX for Dummies Questions & Answers 6 10-25-2008 01:37 PM
Can I know find syntax to find given date files bache_gowda Shell Programming and Scripting 3 03-26-2008 06:37 AM
Little bit weired : Find files in UNIX w/o using find or where command jatin.jain Shell Programming and Scripting 10 09-19-2007 07:47 AM
Find files older than 20 days & not use find halo98 Shell Programming and Scripting 2 05-18-2006 03:19 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-09-2006
Minguccio75 Minguccio75 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 33
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.

Last edited by Minguccio75; 11-10-2006 at 06:58 AM..
  #2 (permalink)  
Old 11-10-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,970
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 (permalink)  
Old 11-10-2006
Minguccio75 Minguccio75 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 33
Thanks Corona688...
can you give me the right commands?
  #4 (permalink)  
Old 11-10-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350

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 (permalink)  
Old 11-13-2006
Sowser Sowser is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 90
scp

just for future reference, use scp to copy files to and from remote areas.
  #6 (permalink)  
Old 11-13-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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.
Closed Thread

Bookmarks

Tags
cpio, mtime

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:42 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0