Monday, February 18, 2013

How can i unzip and rename the output a zip file using Linux CLI?

Q. my problem is that the files inside the zip have a windows non unicode titles so after i "unzip" ,linux fails to write them to the Hdd because of their kwirky names ,so is there a way to unzip and rename the output immidiatly?

A. Unzip seems to be flawed in this capability.

Although I know of no way to change file filename on extraction, you could try these options:

-p extract files to pipe (stdout). Nothing but the file data is
sent to stdout, and the files are always extracted in binary
format, just as they are stored (no conversions).

-a convert text files. Ordinarily all files are extracted exactly
as they are stored (as ``binary`` files). The -a option causes
files identified by zip as text files (those with the `t` label
in zipinfo listings, rather than `b`) to be automatically
extracted as such, converting line endings, end-of-file charac-
ters and the character set itself as necessary. (For example,
Unix files use line feeds (LFs) for end-of-line (EOL) and have
no end-of-file (EOF) marker; Macintoshes use carriage returns
(CRs) for EOLs; and most PC operating systems use CR+LF for EOLs
and control-Z for EOF. In addition, IBM mainframes and the
Michigan Terminal System use EBCDIC rather than the more common
ASCII character set, and NT supports Unicode.) Note that zip`s
identification of text files is by no means perfect; some
``text`` files may actually be binary and vice versa. unzip
therefore prints ``[text]`` or ``[binary]`` as a visual check
for each file it extracts when using the -a option. The -aa
option forces all files to be extracted as text, regardless of
the supposed file type.

-b [general] treat all files as binary (no text conversions). This
is a shortcut for ---a.

-b [Tandem] force the creation files with filecode type 180 (`C`)
when extracting Zip entries marked as "text". (On Tandem, -a is
enabled by default, see above).

-b [VMS] auto-convert binary files (see -a above) to fixed-length,
512-byte record format. Doubling the option (-bb) forces all
files to be extracted in this format. When extracting to stan-
dard output (-c or -p option in effect), the default conversion
of text record delimiters is disabled for binary (-b) resp. all
(-bb) files.

If you know the encoding format of the files inside the archive, read the whiteboard section of this post for a possible clue:

https://blueprints.launchpad.net/unzip/+spec/unzip-detect-filename-encoding

It might be easier to extract them and rename on a windows machine.

Are there any free programs to unzip compressed files?
Q. I used win zip for the free trial and it worked well, I liked it. But now my free trial is over and I'm without a program to unzip compressed files. Normally this isn't a big deal, but I need to download GIMP brushes or fonts to do photo manipulations. Anyone know of a good program to use for this purpose? It needs to be free all the time. I could use a free trial again for now but I'd really like to have a "free all the time" program for this. Thanks!

A. 7Zip is free always. But it only works on Microsoft's Winduhs, if I recall correctly.

If you are running Linux, gzip is already present. Plus, the file managers already know how to zip and unzip, so no addons are required.

How to run a makefile in windows?
Q. I know at school we run it on linux but i have windows on my laptop and im using visual studios 2010 for C++ (express) - can someone please explain what i need to download/do to run makefiles?

A. I don't believe that Visual Studio has any facility for handling a "makefile".

What you can do is download the MinGW C++ compiler.

http://www.mingw.org

Unzip the download into a known location, such as "C:\mingw" on XP, or
"C:\Users\USERNAME\AppData\Local\MinGW" on Windows 7.

Calling that {mingw} to represent whichever case you have:

Set your PATH to include {mingw}\bin and {mingw}\msys\1.0\bin.

The MinGW package includes not only a C++ compiler, but a Bash shell script, awk, sed, grep, and a slew of other UNIX commands that will run on the Windows machine. For your interest, it happens to also include the "make" command, which will process your "makefile".

It might end up running the MinGW compiler against your C++ code, when you might have wanted it to use the Visual Studio compiler, but you can cross that bridge when you come to it.



Nec Projector Review

Plastic Shed Reviews

Ati Graphic Reviews

Nurse Uniforms Reviews

Cabochons Reviews

Inflatable Water Slides Reviews

Barcode Scanner Reviews

No comments:

Post a Comment