Page 1 of 1
HowTo: Make Zip store files with absolute path? [Solved]
Posted: Sat 17 Apr 2010, 06:46
by sunburnt
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?
Re: HowTo: Make Zip store files with absolute path?
Posted: Mon 19 Apr 2010, 16:44
by RetroTechGuy
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?
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...
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
Posted: Mon 19 Apr 2010, 18:27
by 8-bit
Why not just make a PET out of the program.
There are instructions on how to make one and with a PET, all files and directories are placed where they are supposed to go.
Posted: Mon 19 Apr 2010, 19:22
by sunburnt
Hi RetroTechGuy; As I said, a script is then needed to set the current dir. making the archive utilities not so useful by themselves.
8-bit; It`s just a long standing Q I`ve had about the archive utilities...
Posted: Mon 19 Apr 2010, 19:48
by RetroTechGuy
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.
I guess I don't understand what you mean. I just did a quick test, sitting in /root/ (my command prompt "home"):
Which stored the contents of tmp as "mnt/sda3/tmp/____"
Then I did an unzip as:
Which wrote the contents of test.zip back to the directory /mnt/sda3/tmp/, all while my working directory was /root/.
Code: Select all
unzip -d extraction_directory zipfile.zip
tells unzip to start at "extraction_directory" for its unzip operation.
"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
Posted: Mon 19 Apr 2010, 19:54
by sunburnt
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.
Posted: Mon 19 Apr 2010, 20:04
by RetroTechGuy
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.
You are most welcome. Personally, I would set up the special alias, knowing that it is your "restore" function.
(for example, I also typically alias/replace "rm" with "remove", and then reset "rm" to "rm -i", to prevent accidents)
Posted: Tue 20 Apr 2010, 01:36
by sunburnt
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?
Posted: Tue 20 Apr 2010, 02:41
by RetroTechGuy
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?
About the only thing I know off the top of my head is Midnight Commander (a Norton Commander clone).
Haven't used it, however...
Posted: Tue 20 Apr 2010, 03:44
by sunburnt
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.
Posted: Tue 20 Apr 2010, 15:39
by RetroTechGuy
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.
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).
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.
Posted: Tue 20 Apr 2010, 19:44
by sunburnt
Yes... That`s my standard method of copying stuff. I`ll look into it at sometime... Thanks! T.