HowTo: Make Zip store files with absolute path? [Solved]
HowTo: Make Zip store files with absolute path? [Solved]
I`ve tried to get Zip to store with absolute paths, but they`re always relative.
With absolute paths from /, you know exactly where the file is going. Period !
With relative paths, you need a script to set the current path and run Zip. ( Sucks...)
Even Tar insists on removing the leading / from the paths it stores.
Tar has the option: " -P --absolute-names " = Don't strip leading `/'s from file names.
But I can`t get it to work anyway... Error: Cannot stat: No such file or directory ( the Tar file ).
Anyone know how to do this?
With absolute paths from /, you know exactly where the file is going. Period !
With relative paths, you need a script to set the current path and run Zip. ( Sucks...)
Even Tar insists on removing the leading / from the paths it stores.
Tar has the option: " -P --absolute-names " = Don't strip leading `/'s from file names.
But I can`t get it to work anyway... Error: Cannot stat: No such file or directory ( the Tar file ).
Anyone know how to do this?
Last edited by sunburnt on Tue 20 Apr 2010, 13:52, edited 1 time in total.
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
Re: HowTo: Make Zip store files with absolute path?
IIRC (long, long ago I used to be one of Info-Zip's beta testers), the preceding "/" was removed because it caused problems, and presented security risks... And for 99.999% of the users, they didn't want the root filesystem pointer stored anyway...sunburnt wrote:I`ve tried to get Zip to store with absolute paths, but they`re always relative.
With absolute paths from /, you know exactly where the file is going. Period !
With relative paths, you need a script to set the current path and run Zip. ( Sucks...)
Even Tar insists on removing the leading / from the paths it stores.
Tar has the option: " -P --absolute-names " = Don't strip leading `/'s from file names.
But I can`t get it to work anyway... Error: Cannot stat: No such file or directory ( the Tar file ).
Anyone know how to do this?
It will store the whole path, other than the "/". Is that not enough?
Look for "directory-traversal security vulnerability" for example:
http://infozip.sourceforge.net/FAQ.html#corruption
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
I guess I don't understand what you mean. I just did a quick test, sitting in /root/ (my command prompt "home"):sunburnt wrote:Hi RetroTechGuy; As I said, a script is then needed to set the current dir. making the archive utilities not so useful by themselves.
Code: Select all
zip -r test.zip /mnt/sda3/tmp
Then I did an unzip as:
Code: Select all
unzip -d / test.zip
Code: Select all
unzip -d extraction_directory zipfile.zip
"unzip" with no parameters will give you a short help page.
Addendum: You could also set up a batch file, making it perform "unzip -d /" on your input your zipfile, or set up an alias:
Code: Select all
alias restore='unzip -d /'
then
restore test.zip
Last edited by RetroTechGuy on Mon 19 Apr 2010, 19:59, edited 1 time in total.
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
You are most welcome. Personally, I would set up the special alias, knowing that it is your "restore" function.sunburnt wrote:Oooppsss, I was looking at the zip -h page, that should help quite a bit...
having to use a special option isn`t "simple friendly", but it does get the job done!
Thanks T.
(for example, I also typically alias/replace "rm" with "remove", and then reset "rm" to "rm -i", to prevent accidents)
All good ideas, I only use rm in programs, I use Rox for the manual file operations.
Though I`ve wanted a good Win. file Explorer look-alike for years, none work very well.
ROX works well, that`s the other reason I use it, I want dir. panel at left and file on right side.
It would be nice if there was a slide out extra dir. panel to use when copying and moving.
I should look around again as it`s been a year since I`ve looked at them. Any suggestions?
Though I`ve wanted a good Win. file Explorer look-alike for years, none work very well.
ROX works well, that`s the other reason I use it, I want dir. panel at left and file on right side.
It would be nice if there was a slide out extra dir. panel to use when copying and moving.
I should look around again as it`s been a year since I`ve looked at them. Any suggestions?
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
About the only thing I know off the top of my head is Midnight Commander (a Norton Commander clone).sunburnt wrote:All good ideas, I only use rm in programs, I use Rox for the manual file operations.
Though I`ve wanted a good Win. file Explorer look-alike for years, none work very well.
ROX works well, that`s the other reason I use it, I want dir. panel at left and file on right side.
It would be nice if there was a slide out extra dir. panel to use when copying and moving.
I should look around again as it`s been a year since I`ve looked at them. Any suggestions?
Haven't used it, however...
I used Norton`s commander for many years in DOS of course.
I`ve tried MC but it`s like NC, 2 file panels, not like Win. Explorer with 1 dir. and 1 file.
It`s close but... There`s 2 Win.Ex. clones I`ve seen, but they just didn`t work as well as ROX.
I`m sure this had a big impression on Barry when he chose the file manager for Puppy.
I`ve tried MC but it`s like NC, 2 file panels, not like Win. Explorer with 1 dir. and 1 file.
It`s close but... There`s 2 Win.Ex. clones I`ve seen, but they just didn`t work as well as ROX.
I`m sure this had a big impression on Barry when he chose the file manager for Puppy.
- RetroTechGuy
- Posts: 2947
- Joined: Tue 15 Dec 2009, 17:20
- Location: USA
I actually don't use Windows Exploder (nor Internet Exploder). And in those DOS days, wasn't really a fan of NC (I did/do use Qfiler, however).sunburnt wrote: I used Norton`s commander for many years in DOS of course.
I`ve tried MC but it`s like NC, 2 file panels, not like Win. Explorer with 1 dir. and 1 file.
It`s close but... There`s 2 Win.Ex. clones I`ve seen, but they just didn`t work as well as ROX.
I`m sure this had a big impression on Barry when he chose the file manager for Puppy.
What I do when I want 2 windows is simply to open 2 windows...dragging from one, to the other. Rox doesn't care if you have the same folder twice. And you simply navigate up and down to drag and drop.