Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scripting Question

7 views
Skip to first unread message

ToZ

unread,
Jul 22, 2001, 9:58:16 PM7/22/01
to
When I type at the prompt:

find /data -mtime -10 -print

I get an accurate listing of all files that were modified
in the last 10 days. But when i type something like...

cp -auv `find /data -mtime -10 -print` /backup

All of my files get copied over (even those last accessed
> 10 days ago). What am I missing?

I'm using stock RedHat 7.1 with all the latest update incl.
2.4.3-12 kernel.

TIA

Dances With Crows

unread,
Jul 22, 2001, 10:14:04 PM7/22/01
to
On Mon, 23 Jul 2001 01:58:16 GMT, ToZ staggered into the Black Sun and
said:

>When I type at the prompt:
> find /data -mtime -10 -print
>
>I get an accurate listing of all files that were modified
>in the last 10 days. But when i type something like...
>
> cp -auv `find /data -mtime -10 -print` /backup
>
>All of my files get copied over (even those last accessed
> 10 days ago). What am I missing?

find ~/crud -mtime -10 -print
~/crud
~/crud/file_modified_today
~/crud/file_modified_yesterday
[...]

The ~/crud directory shows up because it has been modified within the
last 10 days. You could pipe the output of the find through grep -v
"/data", or you could add "-type f" if you don't have empty directories
to back up, or you could do a couple of other things.

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / That which does not kill us
http://www.brainbench.com / makes us stranger.
-----------------------------/ --Trevor Goodchild, "AEon Flux"

John W. Krahn

unread,
Jul 22, 2001, 11:24:40 PM7/22/01
to

man cp
[snip]
-a, --archive
same as -dpR
^
The recursive flag is grabbing every file in /data's subdirectories.

cp -dpuv `find /data -mtime -10 -print` /backup
# OR
find /data -mtime -10 -exec cp -dpuv {} /backup

John
--
use Perl;
program
fulfillment

0 new messages