LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-11-2010, 01:01 PM   #1
dgeehot
LQ Newbie
 
Registered: Mar 2010
Posts: 2

Rep: Reputation: 0
Help with Find Command - got part of it working but lost


Problem:

I need to copy any files that where either opened, changed or created in the month of February 2010 and then copy those file to a directory called
/u03/feb_act

/home/Test> touch temp -t 201002010000
/home/Test> touch ntemp -t 201003010000
/home/Test> find /home/Test/ -cnewer temp -and ! -cnewer ntemp

It is giving me all the files but also directories that meet that criteria

I would like to look into those directories to see if any of the files meet the criteria and copy those files, and how do I get it to copy these files to a directory called /u03/feb_act

Thanks - DG
 
Old 03-11-2010, 02:15 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,879

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Quote:
/home/Test> find /home/Test/ -cnewer temp -and ! -cnewer
Add a test for file type to the command.
Quote:
/home/Test> find /home/Test/ -type f -cnewer temp -and ! -cnewer
Type f will search for regular files; type d will search for directories.
 
Old 03-11-2010, 03:06 PM   #3
dgeehot
LQ Newbie
 
Registered: Mar 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, how do I copy this files to the directory /u03/internal/Feb_Work/
 
Old 03-11-2010, 03:14 PM   #4
tommylovell
Member
 
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by dgeehot View Post
Thanks, how do I copy this files to the directory /u03/internal/Feb_Work/
Code:
find /home/Test/ -type f -cnewer temp -and ! -cnewer -exec cp -p {} /u03/internal/Feb_Work/ \;
...untested
 
  


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
Find command not working investmentbnker75 Linux - Server 4 10-28-2008 03:37 PM
why isn't this find command working? jim.thornton Linux - Newbie 3 06-10-2008 06:39 AM
[SOLVED] find command is not working postiwala Linux - General 7 09-11-2006 01:25 PM
find command not working correctly? hak_uc Linux - General 10 05-30-2006 08:59 PM
same find command not working in bash script, quotes? QuakerOatz Linux - Software 1 07-14-2003 12:04 PM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration