LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help with Find Command - got part of it working but lost (https://www.linuxquestions.org/questions/linux-newbie-8/help-with-find-command-got-part-of-it-working-but-lost-794761/)

dgeehot 03-11-2010 01:01 PM

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

bigrigdriver 03-11-2010 02:15 PM

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.

dgeehot 03-11-2010 03:06 PM

Thanks, how do I copy this files to the directory /u03/internal/Feb_Work/

tommylovell 03-11-2010 03:14 PM

Quote:

Originally Posted by dgeehot (Post 3894747)
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


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