精华内容
下载资源
问答
  • t unzip a folder only one file, is that right? I get this error: {FramesToPop: 1, code: "EUNSPECIFIED"} Example:- Folder1/Folder2/image.png</p><p>该提问来源于开源项目:mockingbot/react-...
  • <p>When I tried to decompress the folder using miniunz from the sample project (<em>zlib-1.2.11\contrib\vstudio\vc12), I got exception from __inflate_fast_, during the decompression of second file....
  • <div><p>I want unzip ...so, I want to extract all of those files into a folder,but I couldn't find any-thing related to it. <p>Saikiran</p><p>该提问来源于开源项目:Kaggle/kaggle-api</p></div>
  • strFolder = Server.MapPath(@"App_data/targetfolder"); if (!Directory.Exists(strFolder)) Directory.CreateDirectory(strFolder); p.StartInfo.WorkingDirectory = strFolder; p.Start(); if ...

     

    前几天在需要实现一个上传一个Zip目录文件到服务器并且在服务器端解压成目录的功能.从网络上找了很多参考文件,获益良多。目前比较常见的使用方法有
    (1)GzipStream,这是asp.net中自带的方法。对于解压包含单个文件的文件,使用很方便。

    缺点:对于解压包含多个目录的压缩文件,需要编写不少代码。还不一定能做到能解压用户上传的使用通用软件压缩的软件包。 

    (2)使用ICSharpCode.SharpZipLib.dll     下载地址   http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx  

    使用该方法也需要重新写不少代码,有点复杂。
    优点:对于可以实现解压多种文件的功能,可遗址性强。

    缺点:不一定能做到能解压用户上传的使用通用软件压缩的软件包。

    (3)直接实用Shell API调用 7zip   winzip一类解压软件。实现方便简单,代码结构性好,对压缩的兼容性可以依奈系统。

    确定,需要在系统安装可以在shell运行的解压缩软件。最后我决定直接用shell来实现,并且使用开源的截压缩软件7zip.

    下面的关键代码。

    使用说明:

    a.和该代码配合的网页上加一个FileUpload,button控件。Button2_Click为 Button控件的 Click事件响应。

    b.在webconfig.cfg中加上下面的一段,以配置7zip在服务器端的安装情况。
     <connectionStrings>
        <add name="7zip" connectionString="C:/Program Files/7-Zip/7z.exe " providerName=" x "/>
      </connectionStrings> 
    或者直接使用在代码中使用7zip的安装路径。

    c.注意设置服务器端的几个目录第一个为放用户上传好的文件的目录PathOnServer,第二个就是解压程序7zip执行时的当前路径。

            p.StartInfo.WorkingDirectory = strFolder;  

     

     

    展开全文
  • CREATE PROC usp_Copy_Unzip_DirFiles @FTPPath NVARCHAR(4000)= '', -- ftp 文件夹路径 @WorkPath NVARCHAR(4000) = '', -- work 文件夹路径 @FileName NVARCHAR(4000) = '', -- 文件名 @sqlCmd NVARCHAR(4000...
    CREATE PROC usp_Copy_Unzip_DirFiles 
    @FTPPath NVARCHAR(4000)= '',    -- ftp 文件夹路径
    @WorkPath NVARCHAR(4000) = '',  -- work 文件夹路径
    @FileName NVARCHAR(4000) = '',  -- 文件名
    @sqlCmd NVARCHAR(4000) = '', -- 要执行的 cmd 命令
    @RegRule nvarchar(4000) = 'Regex*.zip', -- 定义要拷贝的文件名的规则
    @7zipPath NVARCHAR(4000) = 'IPCC$\"Program Files"\7-Zip\7z.exe',  -- 原理即调用 7z 解压软件解压,所以  IPC 对应到相应的网络磁盘路径
    @IsZipped BIT = 1   -- 输入参数,确认拷贝的 是不是 压缩文件,只有压缩文件,下面的脚本解压部分才需要执行
    AS
    SET @sqlCmd = 'dir /b '+@FTPPath+@RegRule
    IF OBJECT_ID('tempdb..#dirlisttab') IS NOT NULL 
    DROP TABLE tempdb..#dirlisttab
    CREATE TABLE tempdb..#dirlisttab
    (
    FILENAME Nvarchar(128)
    )
    
    
    INSERT INTO #dirlisttab
    EXEC xp_cmdshell @sqlCmd
    --SELECT * FROM #dirlisttab
    
    DECLARE file_cur CURSOR LOCAL STATIC FORWARD_ONLY FOR 
    SELECT [FILENAME] FROM #dirlisttab
    OPEN file_cur
    WHILE 1=1 
    BEGIN 
    fetch next from file_cur into @FileName
    SET @sqlCmd = 'copy '+@FTPPath+@FileName+' '+@WorkPath+@FileName
    print @sqlcmd
    EXEC xp_cmdshell @sqlcmd
    
    IF(@IsZipped = 1)
    BEGIN
    SET @sqlCmd = @7zipPath+' x '+@WorkPath+@FileName+' -y -aos -o'+@WorkPath
    print @sqlcmd
    EXEC xp_cmdshell @sqlcmd
    END
    
    if @@fetch_status <> 0 break;
    END 
    CLOSE file_cur
    DEALLOCATE file_cur
    SET @sqlCmd = ' dir /b '+@WorkPath+'*.txt > '+@WorkPath+'FileName|del '+@WorkPath+'*.zip /Q'
    print @sqlcmd
    EXEC xp_cmdshell @sqlcmd
    DROP TABLE tempdb..#dirlisttab
    GO
    

      

    转载于:https://www.cnblogs.com/Frank99/p/5490888.html

    展开全文
  • When trying to download it on a mac, arkade failed to unzip the file. <h2>Expected Behaviour <p>Lens would be downloaded, extracted, and the binary placed in the arkade bin folder <h2>Current ...
  • - [x] If you are blocked on ARM review and want to get the PR merged urgently, please get the ARM oncall for reviews (RP Manifest Approvers team under Azure Resource Manager service) from IcM and ...
  • iOS : Unable to unzip.

    2020-12-02 15:19:58
    I am trying to zip a file then unzip the same file. But i am getting error while doing so. For folder is working perfectly fine but error is thrown in case of a file <p><strong>Note</strong> : for any...
  • <h3>Pull Request Checklist: <ul><li>[ ] Positive Test Case Written by Dev</li></ul> <ul><li>[ ] Automated Testing</li></ul> <ul><li>[ ] Sufficient User and Developer Documentation</li></ul> ...
  • <p>Try to unzip an unencrypted epub ebook. <h1>Expected Results <p>The unzipped contents of the epub ebook to be unzipped with the same directory structure as the original epub. <h1>Actual Results <p>...
  • <p>so when the folder called 111 has nothing in it, i got nothing after unzip <code>111.zip, which was supposed to be an empt folder called 111. <p>please help~</p><p>该提问来源于开源项目:...
  • <ul><li>Adds to <code>apiConfig.project</code> <strong>mainFolderName</strong> to customize the main project folder for extraction.</li></ul>该提问来源于开源项目:electricjs/electric</p></div>
  • tar -xvf yourfile.tar.gz This will create a same named folder containing uncompressed files. 转载于:https://www.cnblogs.com/RuiYan/p/4098632.html

    tar -xvf yourfile.tar.gz 

    This will create a same named folder containing uncompressed files. 

    转载于:https://www.cnblogs.com/RuiYan/p/4098632.html

    展开全文
  • it occure when i unzip a large folder by commend "!jar xvf CH-SIMS.zip".Can you tell me the solution?</li><li> <p>Describe the expected behavior: </li><li> <p>The web browser you are using ...
  • <div><p>Hi ...<p>I think an alternative would be to unzip the files in a temporary folder or perhaps in .\AppData(Low)Local</p><p>该提问来源于开源项目:sepinf-inc/IPED</p></div>
  • m able to download s3 files into a local folder successfully, until the extraction process always returns a file.zip.cpgz, which unzips to file.zip, and vice-versa. <p>Unzipping from my command line ...
  • <p>The task creates the folder: C:\TestAgent and copies a zip file to it. However, it fails to unzip, causing the above exception. (The missing dll is in that zipfile) <p>We are running TFS 2017 UPD2,...
  • Example1: Syntax for zipping a file or folder. Syntax: zip archivename.zip file1 file2 folder1 ...Note: The extension .zip is not mandatory and this is useful only to identify the file zip file.

    Example1: Syntax for zipping a file or folder.
    Syntax:

    zip archivename.zip file1 file2 folder1
    

    Note: The extension .zip is not mandatory and this is useful only to identify the file zip file.

    Example2: Zip individual files to a zip archive

    zip abc.zip file1 file2 file3
    

    Output:

    surendra@linuxnix:~/test/1$ ls -l file*
    -rw-rw-r-- 1 surendra surendra 188 May 8 10:12 file1
    -rw-rw-r-- 1 surendra surendra 48894 May 8 10:12 file2
    -rw-rw-r-- 1 surendra surendra 41 May 8 10:12 file3
    surendra@linuxnix:~/test/1$ zip abc.zip file1 file2 file3
    adding: file1 (deflated 40%)
    adding: file2 (deflated 54%)
    adding: file3 (deflated 12%)
    surendra@linuxnix:~/test/1$ du -hs abc.zip
    24K abc.zip
    

    Example 3: Zipping a folder is a tricky thing as by default zip will not zip entire folder content such as sub folders and files let us see how a zip command work by default on a folder

    zip abc.zip 1/
    

    Output:

    surendra@linuxnix:~/test$ ls
    1
    surendra@linuxnix:~/test$ zip abc.zip 1/
    adding: 1/ (stored 0%)
    surendra@linuxnix:~/test$ ls -l
    total 8
    drwxrwxr-x 5 surendra surendra 4096 May 8 10:12 1
    -rw-rw-r-- 1 surendra surendra 154 May 8 10:15 abc.zip
    

    If you observe the folder is zipped and 0% is stored which means it did not zip entire folder. To zip first level of folder content use * as shown below

    Output:
    surendra@linuxnix:~/test$ rm abc.zip
    surendra@linuxnix:~/test$ zip abc.zip 1/*
    adding: 1/2/ (stored 0%)
    adding: 1/3/ (stored 0%)
    adding: 1/4/ (stored 0%)
    adding: 1/abc.zip (stored 0%)
    adding: 1/bash-support.zip (stored 0%)
    adding: 1/file1 (deflated 40%)
    adding: 1/file2 (deflated 54%)
    adding: 1/file3 (deflated 12%)
    

    Actually there are sub folders and files in 1 folder, in order to zip all content of a folder use -r option

    zip -r abc.zip 1/
    

    Output:

    surendra@linuxnix:~/test$ du -hs abc.zip
    188K abc.zip
    surendra@linuxnix:~/test$ rm abc.zip
    surendra@linuxnix:~/test$ zip -r abc.zip 1/
    adding: 1/ (stored 0%)
    adding: 1/bash-support.zip (stored 0%)
    adding: 1/file2 (deflated 54%)
    adding: 1/2/ (stored 0%)
    adding: 1/2/5/ (stored 0%)
    adding: 1/2/5/test.sh (deflated 57%)
    adding: 1/2/6/ (stored 0%)
    adding: 1/2/6/dump2.doc (deflated 63%)
    adding: 1/3/ (stored 0%)
    adding: 1/3/5/ (stored 0%)
    adding: 1/3/5/abc.txt (deflated 40%)
    adding: 1/3/5/dump2.doc (deflated 63%)
    adding: 1/file3 (deflated 12%)
    adding: 1/abc.zip (stored 0%)
    adding: 1/4/ (stored 0%)
    adding: 1/4/7/ (stored 0%)
    adding: 1/4/7/dump1.doc (deflated 63%)
    adding: 1/4/7/dump.doc (deflated 63%)
    adding: 1/4/6/ (stored 0%)
    adding: 1/4/6/dump.doc (deflated 63%)
    adding: 1/file1 (deflated 40%)
    surendra@linuxnix:~/test$ du -hs abc.zip
    1.3M abc.zip
    

    If you observe the size of abc.zip is increased considerably and the out of the commend will give you what files are zipped.

    Example 4: How to zip files which are not located in present directory? Suppose I want to zip /home/surendra/test/1 folder in /tmp and I am at /var folder?

    cd /var
    zip -r /tmp/abc.zip /home/surendra/test/1
    du -hs /tmp/abc.zip
    

    If you observe we taken zip in /tmp directory.

    Some times we want to take backups in a tape archive. To directly zip a folder on to tape archive use below command

    zip -r - . | dd of=/dev/nrst1 obs=4k
    

    where nrst1 is my tape archive
    Example5: To compress fast use -1 option and for compress better ratios use -9

    zip -1 -r abc.zip 1/
    

    Clipped output for below time command

    surendra@linuxnix:~/test$ time zip -1 -r abc.zip 1/
    updating: 1/ (stored 0%)
    .....
    updating: 1/file1 (deflated 37%)
    real 0m0.125s
    user 0m0.043s
    sys 0m0.003s
    surendra@linuxnix:~/test$ time zip -9 -r abc.zip 1/
    updating: 1/ (stored 0%)
    .....
    updating: 1/file1 (deflated 40%)
    real 0m0.150s
    user 0m0.147s
    sys 0m0.003s
    

    If you observe the time taken for zip -9 is slightly greater than zip -1 command

    Ok, now we are done with basic zipping files let see how to list, update, delete files in a zip file.

    Example6: How to exclude a file in a folder when compressing it.

    zip -r abc.zip 1/ -x 1/bash-support.zip
    

    Note: When you want to exclude a file/folder use -x option at the end of zip command as show above

    Output:
    surendra@linuxnix:~/test$ zip -r abc.zip 1/ -x 1/bash-support.zip
    adding: 1/ (stored 0%)
    adding: 1/file2 (deflated 54%)
    adding: 1/2/ (stored 0%)
    adding: 1/2/5/ (stored 0%)
    adding: 1/2/5/test.sh (deflated 57%)
    adding: 1/2/6/ (stored 0%)
    adding: 1/2/6/dump2.doc (deflated 63%)
    adding: 1/3/ (stored 0%)
    adding: 1/3/5/ (stored 0%)
    adding: 1/3/5/abc.txt (deflated 40%)
    adding: 1/3/5/dump2.doc (deflated 63%)
    adding: 1/file3 (deflated 12%)
    adding: 1/abc.zip (stored 0%)
    adding: 1/4/ (stored 0%)
    adding: 1/4/7/ (stored 0%)
    adding: 1/4/7/dump1.doc (stored 0%)
    adding: 1/4/7/dump.doc (deflated 63%)
    adding: 1/4/6/ (stored 0%)
    adding: 1/4/6/dump.doc (stored 0%)
    adding: 1/file1 (deflated 40%)
    surendra@linuxnix:~/test$
    

    Eample7: List all the files stored in a zip file

    unzip -l abc.zip
    
    or
    
    less abc.zip
    
    or
    
    zipinfo -1 abc.zip
    

    Output:

    surendra@linuxnix:~/test$ unzip -l abc.zip
    Archive: abc.zip
    Length Date Time Name
    --------- ---------- ----- ----
    0 2014-05-08 10:12 1/
    143449 2014-05-08 10:07 1/bash-support.zip
    48894 2014-05-08 10:12 1/file2
    0 2014-05-08 10:09 1/2/
    0 2014-05-08 10:07 1/2/5/
    543 2014-05-08 10:07 1/2/5/test.sh
    0 2014-05-08 10:08 1/2/6/
    588895 2014-05-08 10:08 1/2/6/dump2.doc
    0 2014-05-08 10:09 1/3/
    0 2014-05-08 10:08 1/3/5/
    188 2014-05-08 10:07 1/3/5/abc.txt
    88895 2014-05-08 10:08 1/3/5/dump2.doc
    41 2014-05-08 10:12 1/file3
    23186 2014-05-08 10:12 1/abc.zip
    0 2014-05-08 10:09 1/4/
    0 2014-05-08 10:08 1/4/7/
    588895 2014-05-08 10:08 1/4/7/dump1.doc
    588895 2014-05-08 10:08 1/4/7/dump.doc
    0 2014-05-08 10:08 1/4/6/
    588895 2014-05-08 10:08 1/4/6/dump.doc
    188 2014-05-08 10:12 1/file1
    --------- -------
    3160964 21 files
    

    Example 8: Delete a file in an archive with out extracting entire zip file.

    zip -d abc.zip path/to/file
    

    Output:

    surendra@linuxnix:~/test$ zip -d abc.zip 1/bash-support.zip
    deleting: 1/bash-support.zip
    surendra@linuxnix:~/test$ unzip -l abc.zip
    Archive: abc.zip
    Length Date Time Name
    --------- ---------- ----- ----
    0 2014-05-08 10:12 1/
    48894 2014-05-08 10:12 1/file2
    0 2014-05-08 10:09 1/2/
    0 2014-05-08 10:07 1/2/5/
    543 2014-05-08 10:07 1/2/5/test.sh
    0 2014-05-08 10:08 1/2/6/
    588895 2014-05-08 10:08 1/2/6/dump2.doc
    0 2014-05-08 10:09 1/3/
    0 2014-05-08 10:08 1/3/5/
    188 2014-05-08 10:07 1/3/5/abc.txt
    588895 2014-05-08 10:08 1/3/5/dump2.doc
    41 2014-05-08 10:12 1/file3
    23186 2014-05-08 10:12 1/abc.zip
    0 2014-05-08 10:09 1/4/
    0 2014-05-08 10:08 1/4/7/
    588895 2014-05-08 10:08 1/4/7/dump1.doc
    588895 2014-05-08 10:08 1/4/7/dump.doc
    0 2014-05-08 10:08 1/4/6/
    588895 2014-05-08 10:08 1/4/6/dump.doc
    188 2014-05-08 10:12 1/file1
    --------- -------
    3017515 20 files
    

    If you observe there is no bash-support.zip file in my zip file

    Example9: To update a particular file which is modified and we want to update our zip file with this update use -u option

    zip -u abc.zip 1/2/6/dump2.doc
    

    output(Clipped):

    surendra@linuxnix:~/test$ unzip -l abc.zip
    Archive: abc.zip
    Length Date Time Name
    --------- ---------- ----- ----
    0 2014-05-08 10:12 1/
    
    0 2014-05-08 10:08 1/2/6/
    588895 2014-05-08 10:08 1/2/6/dump2.doc
    
    188 2014-05-08 10:12 1/file1
    --------- -------
    3017515 20 files
    surendra@linuxnix:~/test$ vi 1/2/6/dump2.doc
    surendra@linuxnix:~/test$ zip -u abc.zip 1/2/6/dump2.doc
    updating: 1/2/6/dump2.doc (deflated 63%)
    surendra@linuxnix:~/test$ unzip -l abc.zip
    Archive: abc.zip
    Length Date Time Name
    --------- ---------- ----- ----
    0 2014-05-08 10:12 1/
    
    0 2014-05-08 10:08 1/2/6/
    588912 2014-05-08 11:03 1/2/6/dump2.doc
    
    188 2014-05-08 10:12 1/file1
    --------- -------
    3017532 20 files
    

    Example10: Update all the files in zip file if the original files are modified

    zip -fr abc.zip 1/
    
    Output:
    surendra@linuxnix:~/test$ > 1/4/6/dump.doc
    surendra@linuxnix:~/test$ > 1/4/7/dump1.doc
    surendra@linuxnix:~/test$ zip -fr abc.zip 1/
    freshening: 1/2/6/ (stored 0%)
    freshening: 1/4/7/dump1.doc (stored 0%)
    freshening: 1/4/6/dump.doc (stored 0%)
    

    if you observe I emptied dump.doc and dump1.doc using “>” in 1/4/6 and 1/4/7 folders respectively and that is the reason only these files are updated to my zip file.

    Now comes the extracting..

    Example 11: Extract your files from a zip folder

    unzip abc.zip
    

    Example12: To extract to a specific directory use -d option

    unzip abc.zip -d /tmp
    

    Output:

    surendra@linuxnix:~/test$ unzip abc.zip -d test/
    Archive: abc.zip
    creating: test/1/
    inflating: test/1/file2
    creating: test/1/2/
    creating: test/1/2/5/
    inflating: test/1/2/5/test.sh
    creating: test/1/2/6/
    inflating: test/1/2/6/dump2.doc
    creating: test/1/3/
    creating: test/1/3/5/
    inflating: test/1/3/5/abc.txt
    inflating: test/1/3/5/dump2.doc
    inflating: test/1/file3
    extracting: test/1/abc.zip
    creating: test/1/4/
    creating: test/1/4/7/
    extracting: test/1/4/7/dump1.doc
    inflating: test/1/4/7/dump.doc
    creating: test/1/4/6/
    extracting: test/1/4/6/dump.doc
    inflating: test/1/file1
    surendra@linuxnix:~/test$ cd test/
    surendra@linuxnix:~/test/test$ ls
    1
    

    Example13: Extract specific file from an archive

    unzip abc.zip 1/2/5/test.sh
    

    In our next post we will see other zipping software’s available.

    展开全文
  • Itsycal must be run from the Applications folder in order to work properly. Please quit Itsycal, move it to the Applications folder and relaunch. </code></pre> <p>I tried from Terminal, open /...
  • Java unzip

    千次阅读 2016-04-18 15:14:18
    网上好多都不靠谱 http://stackoverflow.com/questions/10633595/java-zip-how-to-unzip-folder
  • <p>Depending on whether a user creates a tarball using a trailing slash, a .tar or a .tar.gz file may unzip with or without an enclosing folder. For example, Pantheon allows users to create backups ...
  • <div><p>I have a file in a zip with the character Д in a folder name. It is decompressing to a non-unicode character (being rendered as a ?) in Ubuntu. In OSX it is decompressing to %84. In Ubuntu, ...
  • zip and unzip question

    2021-01-11 23:09:08
    I figured out how to unzip file.txt and how to unzip folder / file.txt. but I can't figure out how to unify this so that when unzipping the system itself understands where just the file is and ...
  • <div><p>When i create a zip file I cant unzip to windows I see hidden folder in the zip!! Any body have a solution? <p><code></code></p> <p>var AdmZip = require("adm-zip"); var zip = ...
  • <p>It modifies the config admin migratable to export the config objects into a different folder from etc to prevent collision if actual config files from etc are exported. <h4>Who is reviewing it? ...
  • boost/1.64.0/testing: WARN: Trying to remove dirty source folder boost/1.64.0/testing: WARN: This can take a while for big packages ERROR: boost/1.64.0/testing: Error in source() method, line 52 ...
  • Unzip png issues

    2021-01-11 23:09:07
    <p>to unzip it return error: Error Domain=SSZipArchiveErrorDomain Code=-2 "failed to open file in zip file" UserInfo={NSLocalizedDescription=failed to open file in zip file} ...
  • 2153 unzip performance

    2020-12-09 08:02:31
    which can be ignored compared to the link_irods_folder_to_django() call which takes 102 seconds as is now. </code></pre> <ol><li>removed the deprecated istorage.size() call. This reduced the link ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 936
精华内容 374
热门标签
关键字:

foldertounzip