Unix - Realizar un tar solo de algunos ficheros (hp-ux)

 
Vista:

Realizar un tar solo de algunos ficheros (hp-ux)

Publicado por maria (1 intervención) el 22/02/2012 15:51:49
Buenas

Me han pedido que realice un tar de una estructura de diferentes directorios y subdirectorios. Hasta hay es fácil, el problema es que me han pedido excluir algunos subdirectorios.

He estado mirando y en Solaris si existe una opción para realizar la exclusión -X pero en HP-UX no encuentro ninguna.

¿Se os ocurre como puedo realizar un tar de solamente algunos directorios y subdirectorios?

Muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de barna_rasta

Realizar un tar solo de algunos ficheros (hp-ux)

Publicado por barna_rasta (61 intervenciones) el 06/03/2012 11:16:47
How to use TAR
Tar is a good utility to produce a backup. When you create a tar archive the destination locatiion could be a tape or a regular file. Note that tar can preserve file's permission and its mode.

For example, you have the following directory structure:

/home/oracle/alex/test
/home/oracle/alex/test/ems
/home/oracle/alex/test/vtools8
/home/oracle/alex/test/psaor01


Create an archive

To create an archive of the entire test directory, issue the following command:

tar cvf my_arch.tar /home/oracle/alex/test

If you want to include into your archive several different directories you might use the following command:

tar cvf my_arch.tar -I include.lst

where the -I option specifies the name of a file with a list of directories and files that you want to include into your archive.

Also, it's possible to exclude certain files and directories from your archive:

tar cvfX my_arch.tar exclude.lst -I include.lst


List an archive contents

To list the contents of your archive issue the following command:

tar tf my_arch.tar


Extract from an archive

To extract the contents of your archive:

tar xvfp my_arch.tar

Note, that everything will be extracted exactly at the same location from where it was taken. If some directories do no exist then they will be created.


Legend of tar's options

c - add to archive, using an absolute path
x - extract from archive
t - read the contents of an archive
f - you work with a file, otherwise it's a tape
p - preserve file's permissions and modes
v - verbose, display the result
-I - use an include list
X - use an exclude list
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar