Greetings and thanks in advance.
I’m having a bit of trouble trying to make a tar that contains multiple files from different directories and does not preserve directory structure . (I just want a tarball with the files only…is there a trick to doing this on Rocky?
Look at the -C option. It’s a bit tricky to get it right because it always works relative to the current directory and the current directory changes every time you invoke the that option on a subsequent directory.
In other words, you have to specify the first directory relative to your current directory, then the second directory relative to the first directory, the third relative to the second and so on.
Ok, will do. I did try the -C had issues, no doubt due to the complexity you are describing.
Will take another run at it tomorrow. As a workaround, I wrote a little bash script to copy all of the files to a temp dir to tar -c from. Then when I extract I use the strip components option. So, it that works but sure could use some simplification… Thanks!
For speed you might want to symlink the files, and use the -h
option to tar to dereference the link. It should result in the same tar file but doesn’t require copying so should be faster and needs less temporary space.