Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

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


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

/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
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
/home/Test> find /home/Test/ -cnewer temp -and ! -cnewer
Add a test for file type to the command.
/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
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
Registered: Nov 2005
Distribution: Fedora, Redhat
Posts: 372

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


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 > Forums > Linux Forums > Linux - Newbie

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

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