If I’ve got a .tar archive, and when I extract it, it gives me a single folder foo containing some more stuff, like this:
foo/
something.txt
another.txt
bar/
something-else.txt
Is there a way I can modify the .tar command to “skip” the root folder (foo in this case) and just extract all the contents of that folder directly into my cwd like this:
something.txt
another.txt
bar/
something-else.txt
--strip-componentswill not just strip leading directories, if you had a tar file that didn't have a directory as its top level entry (e.g., if the contents of the tar file were [file1.txt, somedirectory/] this command would not extract file1.txt. I haven't found a method that only strips a top level directory without causing problems with other kinds of tar files that just have plain files as their top level entry. – jrh Apr 28 '20 at 15:33