This question already has an answer here:
- tarring in parallel 3 answers
I have a directory with several hundred sub-directories. I want to tar and compress each sub-directory and name the resulting file
I have done:
find ./dir -type f -print0 | xargs -0 -n1 -P100 bunzip2
to decompress 100 files at one time. (I do ocean modeling so my machine is quite powerful with many quad cores.) I do not know how to do something like the above while including information on naming the compressed archive file on the fly. I don't want to do
tar cfj dir.tar.bz2 dir for each one.
Can I do it with each directory name being used automatically as the tar file name - via either find or parallel so that 100 or more can be done at a time as in the bunzip command above?
Thank you for input.