SAPCAR (CAR) - the ZIP-Utility of SAP - How does it work ?
SAPCAR (older version was called CAR) is a compress utility (similar to winzip, tar, etc.), that is used by SAP to compress and decompress nearly all delivered files.
SAP Kernel Programs
SAPCAR in general:
SAPCAR (older version was called CAR) is a compress utility (similar to winzip, tar, zip, gz, etc.) , that is used by SAP to compress and decompress nearly all delivered files and executables.
On Windows Operating Systems, the executables are called SAPCAR.EXE and CAR.EXE.
The compressed files are having the extension ".CAR" or ".SAR".
This utility reaches up to 90-95% compression ratio similar to Winzip for text files - binary files are not compressed that good, as this is just not possible. So, it is not useful to compress .CAR or .SAR files with Winzip, because you would no longer benefit with shrinking down in the size.
SAPCAR and CAR are both command line based tools. The syntax is similar to the in the unix enviroment used TAR utility (tar -xvf ...). There does not exist a graphical interface as used to from WinZip.
Difference between CAR and SAR Files
In the past SAP developed the tool and named it CAR. The extensions of all compressed files were named ".CAR" as well. In SAP release 4.6C SAP decided to enhance the functionality of the CAR utility a bit. Therefore, the internal structure of the compressed files slightly changed. Because of this, it was necessary to create a new extension. There the new extension ".SAR" was born and the new utility was named SAPCAR.
The new SAPCAR utility can work with both formats (.CAR & .SAR). The older version CAR can only decompress .CAR files. So, it is advisable to switch - even in older releases - to the newer toolkit named SAPCAR, because SAP sometimes delivers even for older releases SAR Files already.
You can download the latest version of the CAR or SAPCAR in the SAP Service Marketplace. As the binaries are different for each platform, you should have a look at the following link to the releases 4.6D and higher as SAPCAR became available with 4.6C:
Download CAR or SAPCAR in the Kernel Patch directories
How to list the contents of CAR and SAR Files ?
- Go to the directory where you want to list the contents via the "cd" command
- SAPCAR -tvsf <your-SAR-file>
(or car -tvsf <your-SAR-file>)
On AS/400: SAPCAR '-tvsf <your-SAR-file>'
- Then the complete contents of the file is listed on the screen.
- If you want further detailed information, have a look in the
SAPCAR online help below.
How to extract (decompressing) CAR and SAR Files ?
- Go to the directory where you want to decompress via the "cd" command
- SAPCAR -xvf <your-SAR-file>
(or car -xvf <your-SAR-file>)
On AS/400: SAPCAR '-xvf <your-SAR-file>'
- Then all files and directories, that are stored in this archive,
become decompressed.
- If you want further detailed information, have a look in the
SAPCAR online help below.
How to compress files to CAR or SAR Files ?
- Go to the directory where you want to compress via the "cd" command
- SAPCAR -cvf <your-SAR-file> <file-to-compress> (or * for all)
(or car -cvf <your-SAR-file> <file-to-compress>)
On AS/400: SAPCAR '-cvf <your-SAR-file> <file-to-compress>'
- Then this one file or all of the current directory becomes stored
to this archive
- If you want further detailed information, have a look in the
SAPCAR online help below.
'7-Zip' - a totally free file archiver with highest compression ratio - far better than WinZip:
If you are insterested in a free and GUI based tool, that has a 30%-70% better compression ratio than WinZip, hat a look at 7-Zip !
Winzip and Easyzip 2000 as GUI based tools:
In opposite to SAPCAR and CAR the utilities Easyzip 2000 and Winzip for Windows do have a graphical user interface as well, which makes a lot things easier. If you are interested in these features especially in Easyzip 2000 - which is freeware - have a look at Easyzip 2000 & Winzip.
Unfortunately, they are not able to compress and decompress CAR and SAR files. So, if you are dealing with them, you have to use CAR and SAPCAR.
SAPCAR online help with all supported command line options and further examples:
usage:
create a new archive:
SAPCAR -c[vir][f archive] [-P] [-C directory]
[-A filename] [-T filename] [-X filename]
[-p value] [-V] file1 file2 ...
list the contents of an archive:
SAPCAR -t[vs][f archive] [file1 file2....]
extract files from an archive:
SAPCAR -x[v][f archive] [-R directory] [-A filename]
[-V] [file1 file2....]
verify the archive:
SAPCAR -d[v][f archive] [-V] [file1 file2....]
append files to an archive:
SAPCAR -a[v][f archive] file1 [file2....]
merge two archives:
SAPCAR -m[v]f "source target"
check availability of files to be processed:
SAPCAR -l [-A filename][-X filename] [file1 file2...]
other options:
-a : append files to an archive
-acl : save acl (DACL and SACL) for every archive entry (Windows only)
-A FILE : get names to include from file FILE
-C DIR : change to directory DIR
-e : redirect output from stdout to file sapcar_output
-f FILE : use archive file FILE (default DEFAULT.SAR)
-flat : don't preserve file path when extracting files
-g : ignore case of of archive names while extracting,
testing or listing archives
-h : do not change permissions of existing directories
during extraction
-i : ignore inaccessible files while creating an archive
-l : check availabilty of files to be processed
-lower : convert filenames to lowercase while extracting
-m : merge two archives
-n : print statistical information
-p octalvalue : set permissions of all files in archive to value
-P : use absolute path-names (use carefully)
-r : do not resolve symbolic links/shortcuts while creating
an archive
-R dir : use dir instead of current directory
-s : do free space check
-T FILE : rename files to be included in FILE
-v : verbosely list files processed
-V : compute or verify checksum (obsolete, always set,
for backward compatibility)
-X FILE : get names to exclude from FILE
examples:
create archive with all files and directories in the current directory
including point files:
SAPCAR -cvf MY.SAR .
create archive with all files and directories in the current directory
without point files:
SAPCAR -cvf MY.SAR *
Note that SAPCAR treats "*" and "?" as wildcard characters. The former
matches any character string, while the latter matches any single
character.
create archive with a complete directory and directory rights:
SAPCAR -cvf MY.SAR dir
create archive with all files of a directory without the directory
itself:
SAPCAR -cvf MY.SAR dir/*
if during extraction with SAPCAR -xvf MY.SAR the directory dir does not
exist it will be created with rights 755
create archive with only the files of a directory
SAPCAR -cvf MY.SAR -C dir .
or better
(cd dir; SAPCAR -cvf ../MY.SAR .)
merge two archives:
SAPCAR -mvf "a source-archive.sar target archive from 27.5.1999.sar"
append files to an archive:
SAPCAR -avf archive.sar file1 file2 file3
extracting/verifying files:
If you try to extract files from an archive that is not a valid SAPCAR
archive according to the version 2 specification SAPCAR assumes an archive
of the old format and automatically invokes the appropriate extraction
routine. If it still cannot handle the archive it will stop execution.
Notice that extracting out of old archives only works with the command
options known to the old CAR application.
using absolute pathnames:
If you create an archive with absolute pathnames the files will be
extracted with exactly these pathnames! SAPCAR does not cut the first
slash like the UNIX tool tar.
specifying a list of archives for extracting/verifying/listing:
You may call SAPCAR with the following command line:
SAPCAR -xvf "ARCHIVE1.SAR ARCHIVE2.SAR"
thereby specifying a list of archives you want to extract. Note
that you have to delimit archive names with "," if at least one
of the archive names you call SAPCAR with contains at least one
whitespace character; e.g.
SAPCAR -xvf "ARCHIVE WITH BLANK.SAR, ARCHIVE.SAR, ARCHIVE2.SAR"
using A, T and X option:
All entries in the specified files are treated relative to the current
working directory unless the entry is an absolute pathname (in this case
the relevant file will be archived with an absolute pathname).
If you want to specify a directory path in these files use the slash ("/")
as path delimiter.
Use the pipe sign ("|") to separate old and new names in a T file when
these names contain whitespaces. If neither the old file name nor the new
one contains any whitespaces you may use whitespaces as delimiter between
old and new name (that means a valid CAR rename file is also a valid SAPCAR
rename file and hence may be given with the -T option).
Note that pattern matching is not supported for entries in -A, -T and -X
files (i.e. "*.cpp" will not result in processing all cpp-files
in the current directory).
Lines starting with "#" as the first non whitespace character will be
ignored by SAPCAR (this also holds true of lines containing only
whitespaces).
If you insert a directory name in the specified file the complete
directory with the directory rights will be included in the archive.
If you specify dir/filename only this file will be included in
the archive. During extraction the directory dir will be created if
it does not exist.
using -C option:
All relative filenames in the command line are treated as relative
to the specified directory.
|
back
|
12/04/2024, 17:36:47
|