This should go into the Linux_common.ksh library file


cr_tar_apex_common()
{
# Create the tar file
tar -cvf /oracle/admin/scripts/mrc/apex_common_09062017.tar /oracle/admin/scripts/apex/*.ksh
/oracle/admin/scripts/dba120/apex6
}

tar --help

Examples:

# Create archive.tar from files foo and bar.
tar -cf archive.tar foo bar

# List all files in archive.tar verbosely.
tar -tvf archive.tar

# Extract all files from archive.tar
tar -xf archive.tar

On Linux using -cvf will
c = create a tar
v = verbosely list the files
f = use archive file

The tar command allows creating a .tar file that can be gziped for easier transmit and smaller size


To pull a file from the archive you can use this

tar -xzf archive.tar.gz my/path/to/file.txt

To list the files in the archive
tar tzf archive.tar.gz

t = list
z = zipped
v = verbose (if you include this you will see the dates of the files)
f = file archive

tar does not support "in-place" updating of files. However, you can add files to the end of an archive, even if they have the same path as a file already in the archive. In that case, both copies of the file will be in the archive, and the file added later will override the earlier one. The command to use for this is tar r (or tar u to only add files that are newer than the archive) is the command to use. The . in the path should not be a problem.

There is a catch, though: you can't add to a compressed archive. So you would have to do:


Unzip the tar
gunzip archive.tar.gz

add to the tar file once it is unzipped
tar rf archive.tar data/data/com.myapp.backup/./files/settings.txt

rezip the tar file
gzip archive.tar

add to the mrc_10192017.tar file unzipped
tar -rvf mrc_10192017.tar /oracle/admin/scripts/mrc/nc1xtxsb03

Ready for Action?

LET'S GO!
Copyright 2024 IT Remote dot com
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram