linux - How to check for an exploding zip file in bash? -


I have a Bash shell script that opens a zip file, and uses the resulting files. Because of this, I hope that I will prefer all the contents in a folder like:

  file.zip / file / contentfolder1 / contentfolder2 stuff1.txt stuff2.txt ...  

I've seen users on Windows generally do not create a sub folder, but rather submit an explosion zip file. Which::

  file.zip / Contentfolder1 / contentfolder2 stuff1.txt stuff2.txt ...  

How can I detect these explosive pigments? , So that I can handle them accordingly? Is it possible for the first time without unzipping the file?

First open in a directory, and then delete the additional layer if the zipper is not a bomb.

  tempdir = 'mktemp -d` unzip-d $ tempdir file.zip if [$ (ls $ tempdir | wc -l) = 1]; Then MV $ tempdir / * Rmdir $ tempdir and mv $ tempdir file fix  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -