LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 06-23-2006, 08:26 PM   #1
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu
Posts: 1,188

Rep: Reputation: 47
CLI copy files by date


I've done this before in another OS and hope I can do it in Linux. I just downloaded a bunch of files that I want to copy to my USB pendrive-how do I only copy those files with cp by specifying the date? I read the man page and cannot find that option.
 
Old 06-23-2006, 08:51 PM   #2
theoffset
Member
 
Registered: Aug 2005
Location: Guadalajara, Jal, Mexico
Distribution: Slackware Linux
Posts: 211

Rep: Reputation: 30
For what I understand of your problem, I'd use find along with cp.

something like

Code:
$ find . -ctime -7 -exec cp {} /path/to/destiny \;
This should copy files with data modified in the last 7 days (you can specify minutes instead of days with -cmin n, and you can use access time instead with -atime. You can compare with an existing file with -cnewer <file>).

I'd recomemend you to read man find.

Also, I'm pretty sure there are several other ways of doing this.

Last edited by theoffset; 06-23-2006 at 08:54 PM.
 
Old 06-23-2006, 09:01 PM   #3
Geist3
Member
 
Registered: Oct 2003
Location: Richmond, Virginia USA
Distribution: Slackware 12.2
Posts: 59

Rep: Reputation: 15
Something like this

cd to source directory, then:

Code:
mkdir catch; cp -ra $( ls -l | awk '$6~/2006-01-*/ { print $8 }' ) catch
where catch directory is where you want files to end up.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Delete/move/copy files of specific date imsajjadali Red Hat 26 11-07-2013 11:34 PM
CLI copy is greater than GUI copy ?? 0_o killahsmurf Slackware 14 01-04-2006 11:53 AM
Copy files after a certain date davholla Linux - General 2 03-17-2005 09:29 AM
CLI copy & paste between text files? David the H. Linux - General 3 09-15-2004 12:05 PM
How can I copy a directory and it's contents with CLI? CyberLord_7 Linux - General 2 03-30-2004 11:35 AM


All times are GMT -5. The time now is 03:10 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration