Operating System - HP-UX
1832279 Members
2208 Online
110041 Solutions
New Discussion

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

 
ajk_5
Frequent Advisor

find and tar backup the data on different directories they have updated on April, May, June, Jul

Refer to the subject above. Please help. Thanks.

Regards
Ajk
6 REPLIES 6
ajk_5
Frequent Advisor

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

I want to find and tar backup the data on different directories in K260 they have updated on April, May, June, July this year.

I did try "find / +atime -114 -exec ll {} \;" didn't work.

Ajk
Pelephone System
Frequent Advisor

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

Hi
U Can run the cmd

#/bin/ksh

# To See All Files
ll ${DIR} |grep -e Apr -e Nov |awk '{print $NF}' >/tmp/file

# To Backup The Files
for file in `cat /tmp/file`
do
tar -cvf /dev/rmt/0mn # n for no rew
done
HPUX sysadmin
ajk_5
Frequent Advisor

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

Eitan Spector,

I did try "ll ${DIR} |grep -e Apr -e May -e Jun -e Jul", it includes some other years' files. Is it possible to include this year's files of those months only? Thanks!

Ajk
Francisco J. Soler
Honored Contributor

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

Hi Ajk.

If you try to make a find, you obtain the directories as well as files modified, so a ll list everithing, you can try with this:

find / -type f -atime -114 -exec ll {} \;

if you want tar this files you could try:

find / -type f -atime -114 -print | xargs tar cvf file.tar

Be carefully because the file.tar could be tared inside itself in a bad status.

HTH
Frank.
Linux?. Yes, of course.
Pelephone System
Frequent Advisor

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

Hi
U Can run the cmd

#/bin/ksh

# To See All Files
ll ${DIR} |grep -e Apr -e Nov |grep : |awk '{print $NF}' >/tmp/file

# To Backup The Files
for file in `cat /tmp/file`
do
tar -cvf /dev/rmt/0mn # n for no rew
done

add the grep : and u will get only this year files .

Eitan
HPUX sysadmin
James R. Ferguson
Acclaimed Contributor

Re: find and tar backup the data on different directories they have updated on April, May, June, Jul

Hi:

This is quite simple if you use 'find' with the '-newer' argument and two "reference" files to delimit your date boundries:

# touch -amt 03312359 /tmp/ref1
# touch -amt 08010000 /tmp/ref2

# find /tmp -xdev \( -type f -a -newer /tmp/ref1 -a ! -newer /tmp/ref2 \)

Note that a space character follows the delimited open parentheses and prceeds the delimited close parentheses.

Regards!

...JRF...