| Author |
Message |
sunburnt

Joined: 08 Jun 2005 Posts: 4016 Location: Arizona, U.S.A.
|
Posted: Sat 17 Apr 2010, 02:46 Post_subject:
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?
Edited_time_total
|
|
Back to top
|
|
 |
RetroTechGuy

Joined: 15 Dec 2009 Posts: 2303 Location: USA
|
Posted: Mon 19 Apr 2010, 12:44 Post_subject:
Re: HowTo: Make Zip store files with absolute path? |
|
| 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
|
|
Back to top
|
|
 |
8-bit

Joined: 03 Apr 2007 Posts: 3033 Location: Oregon
|
Posted: Mon 19 Apr 2010, 14:27 Post_subject:
|
|
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.
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4016 Location: Arizona, U.S.A.
|
Posted: Mon 19 Apr 2010, 15:22 Post_subject:
|
|
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...
|
|
Back to top
|
|
 |
RetroTechGuy

Joined: 15 Dec 2009 Posts: 2303 Location: USA
|
Posted: Mon 19 Apr 2010, 15:48 Post_subject:
|
|
| 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"):
| Code: | | zip -r test.zip /mnt/sda3/tmp |
Which stored the contents of tmp as "mnt/sda3/tmp/____"
Then I did an unzip as:
| Code: | | unzip -d / test.zip |
Which wrote the contents of test.zip back to the directory /mnt/sda3/tmp/, all while my working directory was /root/.
| Code: | | 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: | alias restore='unzip -d /'
then
restore test.zip |
Edited_time_total
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4016 Location: Arizona, U.S.A.
|
Posted: Mon 19 Apr 2010, 15:54 Post_subject:
|
|
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.
|
|
Back to top
|
|
 |
RetroTechGuy

Joined: 15 Dec 2009 Posts: 2303 Location: USA
|
Posted: Mon 19 Apr 2010, 16:04 Post_subject:
|
|
| 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)
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4016 Location: Arizona, U.S.A.
|
Posted: Mon 19 Apr 2010, 21:36 Post_subject:
|
|
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?
|
|
Back to top
|
|
 |
RetroTechGuy

Joined: 15 Dec 2009 Posts: 2303 Location: USA
|
Posted: Mon 19 Apr 2010, 22:41 Post_subject:
|
|
| 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...
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4016 Location: Arizona, U.S.A.
|
Posted: Mon 19 Apr 2010, 23:44 Post_subject:
|
|
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.
|
|
Back to top
|
|
 |
RetroTechGuy

Joined: 15 Dec 2009 Posts: 2303 Location: USA
|
Posted: Tue 20 Apr 2010, 11:39 Post_subject:
|
|
| 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.
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4016 Location: Arizona, U.S.A.
|
Posted: Tue 20 Apr 2010, 15:44 Post_subject:
|
|
Yes... That`s my standard method of copying stuff. I`ll look into it at sometime... Thanks! T.
|
|
Back to top
|
|
 |
|