LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-18-2008, 07:19 PM   #1
Shinigami101
LQ Newbie
 
Registered: Nov 2008
Posts: 7

Rep: Reputation: 0
SCP copy file with dynamic date( or something like that)


Ok here is my problem/issue/question that i need some help with.

I am trying to copy a log file that is generated every day. the file will look something like "example.log.20081119.gz", what i want to do is create an scp script/command that will copy this log from a different server.

now because i am starting the connection from a windows box i am using pscp, so far what i have looked at is something like "'pscp -scp -l root -pw ******* draco:/var/log/squid/access.log.'date +"%Y%m%d"'.gz ."

now this does not work.. but i thought it might help you get an idea of what i am trying to do.

i shall endeavor to find the answer but if someone knows how to that would be great.

Thanks.
 
Old 11-18-2008, 08:06 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,656

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by Shinigami101 View Post
Ok here is my problem/issue/question that i need some help with.

I am trying to copy a log file that is generated every day. the file will look something like "example.log.20081119.gz", what i want to do is create an scp script/command that will copy this log from a different server.

now because i am starting the connection from a windows box i am using pscp, so far what i have looked at is something like "'pscp -scp -l root -pw ******* draco:/var/log/squid/access.log.'date +"%Y%m%d"'.gz ."

now this does not work.. but i thought it might help you get an idea of what i am trying to do.

i shall endeavor to find the answer but if someone knows how to that would be great.

Thanks.
Check out the mtime and ctime params, but they may only work with Linux. You're going to be limited on what you can do with Windows, though.

I know there are lots of Perl modules for date/time string manipulation, which SHOULD work on Windows, but have no idea if it does or not. Perl SHOULD work under Windows, and let you write a script to do what you'd like, including SCP'ing a file. Check out CPAN.org.
 
Old 11-18-2008, 09:26 PM   #3
Shinigami101
LQ Newbie
 
Registered: Nov 2008
Posts: 7

Original Poster
Rep: Reputation: 0
What if i was doing it from linux, how would i go about it?
 
Old 11-19-2008, 07:56 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,656

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by Shinigami101 View Post
What if i was doing it from linux, how would i go about it?
Same way, or you could write a BASH script, which would work with ctime/mtime/atime. Lots of different ways to do things...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SCP: Copy file from remote linux server onto a windows machine? Tony Empire Linux - Newbie 21 09-22-2015 10:18 PM
Need to copy file (scp) to Debian server when reached 150 kb spaceuser Linux - Newbie 1 07-20-2008 03:56 PM
SCP Copy File SSH petenyce Linux - Wireless Networking 2 10-05-2005 03:11 PM
scp/ssh tail(multiple file) remote copy tpreitano Linux - General 1 08-22-2005 02:17 PM
scp :copy file from one remote comp to another aniketh Linux - Networking 4 06-16-2004 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration