Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can it rename the toplevel directory name before extracting? (My main problem with tar)


you can provide the top level directory where it will extract with the -e command line switch


No, sorry for being unclear, I mean if the archive contains a toplevel folder e.g. binutils-1.0.0, that I can rename it to binutils before extracting (so I don't end up with the binutils-1.0.0 on my filesystem), and preferably in such a way that I don't have to know the toplevel folder name before extracting.


    tar -xf example.tar -C temp-dir && mv temp-dir/* $(echo temp-dir/* | sed -r 's,.*/([^/]+)-[0-9.]+,./\1,')


Yeah, exactly the kind of command-line that I would like to avoid ;)


Among other things, it's a shame that there's no dedicated standard-ish CLI tool for manipulating pathnames.


Sadly no, unblob cannot do that. I'll look into it tho.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: