|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
tar tar o tar, BEHAVE DAM*** ;)
ok am trying to get an automated tar script going and having trouble getting the directory listing into my tar script. Have three directories that all have to be archived in sequence the first two fit onto a tape but for the third I have to switch tapes. This is where my script is supposed to come in.
ls -lR >dir.txt grep dir3 dir.txt > dir3.txt tar -rvfHXI /dev/rmt0 dir.one dir.txt > protocoll this is the meat and potatoes part of my script. The ifs and whiles all work just here it seems 1st that grep doesnt pull all the files that are under dir3 out. And as everyone knows absolute pathnames are a no no when archiving. Thanks in advance for your help. Oh yeah this is being done under AIX 4.3 (curse curse curse....where is the legacy support?) |
|
#2
|
|||
|
|||
|
so, a little shell
i don't understand why, but if i shound do this: ls -lR >dir.txt grep dir3 dir.txt > dir3.txt i would use: ls -lR | grep dir3 >dir3.txt find will make a better job! ---- i also don't know the tar options 'rHXI' what's 'dir.one' ? dir.txt is a LIST of files, what do you want: save the LIST or save the files listed in LIST? assumed you want save to tape the files listed in LIST: version 1: (the bad one) tar cvf /dev/rmt0 `cat dir.txt` REMEMBER this would not work because of the 'l' in the 'ls' command above version 2: (preferred) tar cvf /dev/rmt0 . NOTA: tar does not need the '-' sign the redirect '>protocoll' is useless, then the tar output is defined by the 'f' opt, in this case '/dev/rmt0' i don't know if your tar is able to manage multi-volume tapes. by large files i would use something better like 'ufsdump' did you still heard about the 'man' command ? Last edited by guggach : October 4th, 2004 at 02:38 AM. Reason: typo |
|
#3
|
|||
|
|||
|
oops...
apparently I was doing a bit of half asleep googling and the switches X and I are not even supported by this version of AIX....
... the X was actually supposed to exclude the list in dir.one ( I know unix doesnt need the file endings but its hard to beat outta me also helps keep me straight). And yes you are right guggach I want to save the files in the list, by piping the output to "protocoll" I can also create a log as well as archiving everything that I wanted to. I have gotten that to work on tar commands before. Will try your solution, thnx. |
|
#4
|
|||
|
|||
|
You're grep isn't working because you're using "ls -lR"
"find" is a much better command, although note that the following will give you different results Code:
#-- This lists in long format directories but files twice since
#-- it's listing the file and the directory containing the file:
find . -exec ls -l {} \;
#-- This lists in long format the directories only:
find . -type d -exec ls -ld {} \;
#-- This lists in long format the files only:
find . -type f -exec ls -l {} \;
#-- You could always just do:
find . -ls
|
|
#5
|
|||
|
|||
|
thx find is a better solution
probably wouldnt have gotten that one on my own. Tried a few things with it before my boss took over our AIX machine so no more scripting today maybe tomorrow. But does anyone know if the results from find can be used well with tar ? It looks good (like I said absolute trees are baaaaad).
|
|
#6
|
|||
|
|||
|
absolute trees are NOT baaaaad
they are very, very baaaaad and 100% legal do you like to destroy your system ? try(you need root perms) cd /; tar cfb - 126k /usr |(cd /tmp; tar xfpv -) sit down, get a cigar maybe a wisky and watch..... extremely intructive (keep a cd to rebuild the sys) btw: ONE char is wrong !!! ![]() you just need 2tons experience to read them back ![]() and it's feasible..... what do you want, tar a dir (or more) or tar single files ? |
|
#7
|
|||
|
|||
|
I have three directories I am trying to tar with a script lets call them A B and C and they are so set up that A contains B and C but has several little files that should be archived with B and its structure plus files. That is my first tape. and C is supposed to be my second tape with directory and files. The script I am writing is supposed to ask the user to insert a tape when the A and B have been archived. Problem is with the lists I have been getting I either get the directories or the filenames or I get it so that A, B, and C get archived both times. Havent figured out a way yet to exclude C but inlcude the contents of A plus contents of B with its relative structure.
(I have chainsaw and am looking for vodka drinking trees) ![]() |
|
#8
|
|||
|
|||
|
AIX and tar
I have following line in my script
tar -cvhL tarlist /dev/rmt0 <directory> > protocol reads the list and archives all the data I want onto the tape drive. Problem is my endusers dont like seeing what happens after starting ti I get a message that /dev/rmt0 isnt a viable variable for tar I mean it tars everything ok. anyone have any idea what gives ?? |
|
#9
|
|||
|
|||
|
Quote:
I am sure they ported GNU tar to AIX too. If you don't have to use the AIX tar for a specific reason, have a look here: http://www.gnu.org/software/tar/ hth, M.
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#10
|
|||
|
|||
|
unfortunately I have to use AIX tar. (The customers are too cheap to upgrade their systems from 4.3xxx.) And I gotta program to fit their systems. Got it working now though was actually simpler than I thought. Thanks for the ideas guys.
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > tar tar o tar, BEHAVE DAM*** ;) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|