Compress a dir into many small tar and uncompress it back to same parent directory - unix

I have huge(90GB) directory which i want to compress into multiple .tgz files in a way that, when i untar all these small .tgz files they all uncompress to same main directory.
For eg:
Parent_dir/1-1000000files
Compress it to multiple small subset1.tgz subset2.tgz subset3.tgz etc.
Now hen i uncompress they all should expand to same Parent_dir.
I have used tar czvf name/of/tar files/to/compress
How can i achieve this ..?

Related

Unzip specific files in a ARR file within a Tar.gz

i'am currently trying to unzip some specific files within a ARR file. This ARR file is within a tar.gz file.
Is it possible to unzip these files without a intermediate step/One liner. Its important that the first tar.gz will not be unpacked.
Thanks!
you can try something like:
gzip -dc input_file.tar.gz|tar xf - path/to/file/you/want/to/extract
This decompress and untar the archive in memory and have advantage of run faster.

Compress or copy folder to stdout

I can't compress folder recursively to stdout. Zip and 7-zip can one file to stdout, but not folder. Rar not compatible compress to stdout in principle. Tar, GZip, Bzip2 - obviously, etc. Please help me find to solution...

UNIX: how to zip a folder that contains more folders w/o including any of the folder paths

I' m trying to zip a folder that contains some .json files plus subfolders with more .json files. I need to zip the parent folder with everything included without containing any of the parent or subfolders paths. Is there any way I can do this?
Thank you
EDIT:
I want this:
pending_provider/722c9cb2-268b-4e4a-9000-f7f65e586011-version/1d296136-ac87-424e-89c4-682a63c7b853.json (deflated 68%)
But not this:
pending_provider/722c9cb2-268b-4e4a-9000-f7f65e586011-version/ (stored 0%)
I want to avoid the "stor" compression type which only saves the folder path. I want only the "defN"
So the -j doesn't help me a lot
Thanks
If you don't want any paths at all you could use the -j option. Below is the man page entry for the option.
-j
--junk-paths
Store just the name of a saved file (junk the path), and do not store
directory names. By default, zip will store the full path (relative to
the current directory).
If you just want to exclude directories
-D
--no-dir-entries
Do not create entries in the zip archive for directories.

Use Robocopy to copy files from source that have changed or are new when compared to a specified folder to a 3rd folder

I have a large folder of files that needs to be transferred to a remote site. This folder is currently 10GB total, but contains lots of much smaller files.
Rather than copying the entire 10GB each time, we'd like to massively reduce the data transfer size to be only the files that are new or changed. We plan to do this like so:
SOURCE_DIR is the folder that has all the files and is up-to-date.
COMPARE_DIR is a directory "clone" of the folder at the remote end. It is basically all the files up to the last time files were transferred.
TRANSFER_DIR is an empty folder that (we hope) ROBOCOPY can place files that are new or changed in SOURCE_DIR when compared with COMPARE_DIR into.
An example:
SOURCE_DIR has 4 files: 1.txt, 2.txt, 3.txt, 4.txt
COMPARE_DIR has 3 of those files: 1.txt, 2.txt, 3.txt
The ROBOCOPY command would compare SOURCE_DIR with COMPARE_DIR and see that 4.txt isn't in COMPARE_DIR so copies it into TRANSFER_DIR
TRANSFER_DIR then only has 4.txt file in it which we can copy up to the remote end and place in the folder making it the same as our SOURCE_DIR this end.
This can be done with rsync using the --compare-dest=DIR argument, but as this is Windows, I'd rather not have to install rsync unless I need to.

unzip all files and save all contents in a single folder - unix

I have a single directory containing multiple zip files that contain .jpg files.
I need to unzip all files and save all contents (.jpgs files) into a single folder.
Any suggestions on a unix command that does that?
Please note that some of the contents (jpgs) might exist with same name in multiple zipped files, I need to keep all jpgs.
thanks
unzip '*.zip' -o -B
as by default these utilities are not installed
see http://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html regarding installation
read about -B flag to realize its limitations.

Resources