1 |
On Thursday 28 September 2006 18:16, maxim wexler wrote: |
2 |
> Hi group, |
3 |
> |
4 |
> I'd like to be able to cp or mv certain files from a |
5 |
> dir according to their timestamp. |
6 |
> |
7 |
> man cp mentions the '--preserve' option but I don't |
8 |
> think that's what I need. |
9 |
> |
10 |
> Does somebody know of some sort of script or perl or |
11 |
> python pass that'll do it? |
12 |
|
13 |
use find with the time-related options and -exec. To move |
14 |
everything in ~/mystuff that's older than 3 days (72 hours) to |
15 |
~/backup, you could use |
16 |
|
17 |
find ~/mystuff -type f -mtime 72 -exec mv {} ~/backup \; |
18 |
|
19 |
find has many options related to searching by time (hours, |
20 |
minutes, etc) and you can select by atime, ctime or mtime. It's |
21 |
all in the man page |
22 |
|
23 |
alan |
24 |
-- |
25 |
gentoo-user@g.o mailing list |