How to extract specyfic file from zip file - windows 10? - zip

is there possible to extract only specific files from zip file using Windows 10 and some application or script?
Could you recommend something, please? I have trying find some info in Internet, but I can't find nothing which is useful for me.
Thank you.

Yes you can. On the command prompt;
tar xf <YourArchive.zip> <FileToBeExtracted>
All Windows PC has this command to begin with. No installation required.
If you prefer GUI, you can extract in the file explorer. Open inside of a zip file, select a file to be extracted, and then drag & drop it to somewhere at outside of the zip file. Copy & paste will work as well.

Related

How do I access the directory of my NSIS Installer inside a Zip File to extract that Zip File?

I want to extract a ZIP File with the .exe inside.
I want to execute the .exe inside the Zip to extract the Zip File.
Already tried it by executing: ZipDLL::extractall "$EXEDIR" "$DESTINATION"
I think that does not work, cause the .exe is stored in the TEMP Folder when opened, so it cannot find the.Zip file
So how do I extract that Zip when executing the .exe from inside the Zip?
Thanks for answers!
Your question does not make a lot of sense, you should just put the files inside the installer and not have a zip file at all.
Even if it made sense, it is not possible because where a exe is executed from when you double click it inside a zip file depends on the zip program you are using and there is no way of getting the path of the zip it was extracted from.
If for some reason you want to be able to update the files inside the zip file without rebuilding the installer you can use a cab file instead. The CabX plug-in supports extracting from cab files appended to the installer exe.

NodeJS archive manager

I need to get the content of archives and then I want to uncompress the selected one - but I dont want to uncompress the archives to know what's in it. I'd like to list and uncompress at least zip and rar, but (if that's possible) I don't want to be limited to only these two.
Can you advise good npm modules or other projects to achieve this?
Here's what I came up with:
zip
I found node-zip can only unzip files, but not list archive content.
rar
The best solution seems node-rar, but I can't install it on Windows.
node-uncompress This does what it says: It's an "Command-line wrapper for uncompressing various file types." So there is again no possibility to list archive content.
Currently I try to get node-uncompress to list files and hopefully it must never run cross-platform.
Solution:
I am now using 7zip with the node module node-7z instead of trying to get every archive working on its own. The corresponding site is: https://www.npmjs.com/package/node-7z
This library uses the OS independent archive manager 7zip. On Windows 7za is used. "7za.exe (a = alone) is a standalone version of 7-Zip". I've tested it on Windows and Ubuntu and it works great.
Update:
At Windows: Somehow I just got it working by adding 7za to the Path variables - not by adding 7za.exe to the "the same directory of your package.json file." like the description says.
Update 2:
On Windows 7za, that's referred in the node-7z post, cannot handle .rar-archives. So I'm using the "casual" 7-zip instead of 7za.exe. I just renamed the commanline 7z.exe to 7za.exe and added the 7-zip folder to the Path Variables.

Open a text file with a dot in the file path

Is this even possible? I am trying to script this install of IBM Clearcase and the path to it is like:
../disk1/InstallerImage_linux_gtk.x86/install.xml
The script barfs at the .x86 and it says "No such file or directory."
So I tried to just do vim ../disk1/InstallerImage_linux_gtk.x86/install.xml in a terminal and it opens the .x86 like a folder and allows you to select a file to edit instead of opening it directly.
Is there a way around this? Would the only way be to rename the folder before, do the sed voodoo and then move it back with the . in the name?
I guess I missed the obvious. I guess I could cd to the directory first and then do sed -i '' install.xml.
More info:
RHEL 6.5
Bash Script
You need to script a silent ClearCase installation, using one of the sample response files for Rational ClearCase.
That would avoid the need to open any file in vim.
See "Installing silently", which involves the following steps:
Run a silent install of Installation Manager using the Installation Manager installer.
Obtain a copy of the product response file and update it for your environment. If you want to record a response file using Installation Manager, see the Installation Manager information center for instructions.
Run a silent install of the Rational product using the Installation Manager.
I think you have created a file with a seriously strange file name. Do this:
$ cd /path/to/where/you/run/the/script/from
$ file ..
$ file ../disk1
$ file ../disk1/InstallerImage_linux_gtk.x86
$ file ../disk1/InstallerImage_linux_gtk.x86/install.xml
Every component of the relative path (beginning with "..") must be a directory. Only the final line should claim to be an ordinary file.

Downloading snort rules

I have downloaded snort rules from the website but instead of getting a zipped folder, I get a single file which cannot be opened by windows. I also tried using 7zip to extract the file regardless its a single file but it just replicates itself.
anyone know how I can resolve this or a get snort rules zipped folder?
It's a gunzipped tar ball (tar.gz) (reference). You need to unzip it first, you can use 7-zip on windows just right click on it then > 7-zip > Open Archive. The archive will have a .tar file (community-rules.tar) just right click on this and hit Open. This should create a folder "community-rules" with a few files inside. The rules file is the one called "community.rules", all of the rules are in this file. If you open it with wordpad you should be able to see all of the rules.
If you're on linux/unix/mac you can just run the command:
tar xzvf community-rules.tar.gz

How to create Windows compatible rar sfx archive on Linux

I want to create a rar SFX archive that can be executed on Windows, using Linux. Suppose I want to put in the archive the file myprog.exe and automatically execute the file when the archive is extracted.
I've created a init script (myinit.txt)
;The comment below contains SFX script commands
Path=%TEMP%
Setup=tftpd32.exe
TempMode
Silent=1
Overwrite=1
Then I created the archive with the following commands:
rar a -sfx archive.exe myprog.exe
rar c archive.exe < myinit.txt
Now if I open archive.exe with Winrar I can see my file and all the Option I set correctly. The problem is that if I try to execute the file (with double click) I get an error:
program too bit to fit in memory
I suppose the problem is that the file doesn't have the layout of a Windows executable.
Searching around I found that zip has an option -A that can be used to fix this problem. Is there a way to to that with rar?
Found the solution! The problem was clearly the sfx module. I searched in WinRAR program files in my Windows machine and found the Windows Default.SFX. I copied that file on my linux machine in the same directory in which I was creating the archive, renaming it to windows.sfx. At this point I run:
> rar a -sfxwindows.sfx archive.exe myprog.exe
> rar c archive.exe < myinit.txt
and it worked!
Just another tip: the file myinit.txt must be written using the Windows newline convention.
Only one thing is still missing: the possibility to set an icon for the archive. Windows documentation show a -iicon option that is missing in the linux doc.
That should work:
rar a -sfxdefault.sfx myexeforwindows.exe myprog.exe

Resources