How can I use tar command to group files without compression?
I have a very large folder of 120,000+ files. and I need to move them to another location on my same machine (same partition).
I'd like to use the tar
command to group them up as a single unit and then mv
them to the end location.
What command do I need to run to tar
them all together and not compress anything (I need the fastest result).
tar
does not compress by default, just don't add a compression option:
tar -cvf myfolder.tar myfolder
I am including Hennes' comment in my answer since it adds useful information:
TAR (tape archive) is originally a unix program used to create archives on tape. Since all devices are treated as files under unix it is easy not to write to a tape but to a file instead. This is usually done with the -f flag. The command tar cvf myfolder.tar myfolder means tar, create, verbose file filename_to_create what_to_tar. There is no compression in this anywhere. Tar archives (as files) where often compressed using the compress program and gained the extention .Z (e.g. file.tar.Z). Later on this got included in gtar with the z flag
The @terdon answer is right.
But I made a small mistake doing tar cvf myfolder.tar.gz myfolder
. I wanted same ending names for the files in the same path tar.gz
even when it's not compressed.
So, if you put something like .gz, .z
at the end of the filename you're trying to tar, the tar app will understand you want to use some compression, and it will apply accordingly to what you put (gz = gzip).
So if you want to use a extension like that tar.gz
, make sure to use the flag --no-auto-compress
--no-auto-compress do not use archive suffix to determine the compression
program