How do I compress every file in a directory into its own tar whilst preserving the name for each file?
i.e. file1.out file2.out
Putting every file into a separate tar file doesn't make any sense in this scenario. You can use
will result in
You would use
If you ineed need a tar archive for every file, you can create it like so:
To build on @SvenW's answer (which will only work on the current directory), if you have a HUGE number of files or want to do it on a recursive directory structure you can also use
and if you need to put the output into a different directory (in this example,