7zip

How would I compress a folder with 7Zip in C#?

筅森魡賤 提交于 2019-12-06 11:57:10
I want to compress a folder into a file with the .7z extension, with 7zip. I would like to know how I would do this, because I'm not sure (which is why I'd asking.) This is in C#. Links to pages or sample code would be helpful. code to zip or unzip file using 7zip this code is used to zip a folder public void CreateZipFolder(string sourceName, string targetName) { // this code use for zip a folder sourceName = @"d:\Data Files"; // folder to be zip targetName = @"d:\Data Files.zip"; // zip name you can change ProcessStartInfo p = new ProcessStartInfo(); p.FileName = @"D:\7-Zip\7z.exe"; p

pywinauto: How to select this dialog? Which spying tool to use? What information do I need on it?

随声附和 提交于 2019-12-06 10:25:39
问题 How can I write "hello" on the first field of the 7-zip "Add to Archive" dialog? I managed so far to trigger the 7-zip (windows 64x) "Add to Archive" dialog using this from pywinauto.application import Application app = Application().start(r"C:\Program Files\7-Zip\7zFM.exe") #set the app app.top_window_().Edit.type_keys(r"C:\Users\me\Desktop{ENTER}") app.top_window_().SysListView32.Select(r'test.txt') #select files in list app.top_window_().ToolbarAdd.TypeKeys("{ENTER}") #apply Then I can't

7z “Incorrect command line” when I run the script in a different drive than C:

元气小坏坏 提交于 2019-12-06 09:49:28
I'm doing a batch script so I can compress multiple directories inside a specific folder. The thing is it works perfectly if the folder is at C:\something, but if I try to do the same to a folder in i.e E:\something, I get an error. The script is this: @ECHO OFF if %1.==. ( SET "rootpath=%cd%" ) else ( SET "rootpath=%~1" ) FOR /D %%D IN ("%rootpath%\*") DO ( 7za a -t7z %%D.7z %%D\* -mx9 ) Example of how it works normally: C:\Users\Me\Desktop\ExampleFolder>script 7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning Creating archive C:\Users\Me\Desktop\ExampleFolder\D1.7z

7zip SFX Batch For SendTo Folder

独自空忆成欢 提交于 2019-12-06 09:41:41
7z a -mx9 -sfx %1.exe %1 This is what i have so far as a batch file, which if i drag and drop a file or folder onto the batch file i get a 7zip SFX on Ultra Compression under the same name as the original file. but this only works if the file is in the same folder as the batch file. What im trying to achieve is, putting this batch file into the sendto folder so i can convert any file anywhere into a highly compressed exe, which appear in the folder of the original directory. Any help would be greatly appreciated, im sure its simple but i haven't a clue. Edit 29 May @ 16:50 [HKEY_CLASSES_ROOT*

using 7zip sdk to compress a file, but the archive file is not as original and can not decompress using unrar

扶醉桌前 提交于 2019-12-06 08:06:27
I am using 7zip sdk (http://www.7-zip.org/sdk.html) to compress a file. it works fine using this wrapper: public void EncodeSingleFile(FileStream inStream, FileStream outStream) { bool eos = false; Int32 dictionary = 1 << 21; Int32 posStateBits = 2; Int32 litContextBits = 3; // for normal files // UInt32 litContextBits = 0; // for 32-bit data Int32 litPosBits = 0; // UInt32 litPosBits = 2; // for 32-bit data Int32 algorithm = 2; Int32 numFastBytes = 128; string mf = "bt4"; propIDs = new CoderPropID[] { CoderPropID.DictionarySize, CoderPropID.PosStateBits, CoderPropID.LitContextBits,

How to print and capture 7zip's % progress markers when executing from python?

久未见 提交于 2019-12-06 07:12:19
问题 When 7zip runs from the command line, it will print a progress bar using a series of '%' symbols. I'd like to both capture and print this progress bar when executing 7zip from within Python. How do I do this? The Python code I'm currently using: from subprocess import Popen, PIPE pipe = Popen('7za.exe a -tgzip "e:\\backup\\sch Testerr 2012 06 23 17-27.gzip" "E:/archiv"' , stdout=PIPE) text = pipe.communicate()[0] print text 回答1: What you want is sys.stdout.flush(). However, you may need to

7-Zip execution permissions on Windows Server 2008 64-bit

流过昼夜 提交于 2019-12-06 05:52:43
问题 I've created a self-extracting 7-Zip file. There is one CMD file contained in it which 7-Zip runs on extract. This cmd reads the registry and performs some further activities (unimportant to this specific question). In Windows Server 2003 32-bit this behavior works just fine. However, testing on a Windows Server 2008 box shows that the cmd kicked off by 7-Zip doesn't have permissions to read the registry. More specifically it can read some areas (Windows current version), but not others

7z command line to compress folders

冷暖自知 提交于 2019-12-06 04:32:11
问题 I am trying to zip/7z folders using the command line of 7zG.exe. The code I have works for files but not folders. Could someone please show me the correct way using 7z command line to compress folders? Here is the sample code that works for files only. Whenever I try running this code 7zip shows a messagebox saying "Invalid Parameter" string sourceName = "Folder\Folder1"; string targetName = "Example.gz"; // 1 // Initialize process information. // ProcessStartInfo p = new ProcessStartInfo();

How to compress a Folder uses lzma sdk?

最后都变了- 提交于 2019-12-06 04:22:45
http://www.7-zip.org/sdk.html I can uses it compress a file, but can not find function of compress a Folder Arnaud Bouchez You'll have to create a .7z archive, then include all files of the folder within. There is no direct "folder" compression: just compression of files. If you store a (relative) folder name within the file name (e.g. 'FolderName\FileName'), the folder 'FolderName' will appear within the archive. You have within the SDK a ANSI-C compatible source code for 7z decompression with example. You'll have to adapt it to add all files of the folder to the archive (using FindFirst /

Iterating through folders and files in batch file?

做~自己de王妃 提交于 2019-12-06 03:55:31
问题 Here's my situation. A project has as objective to migrate some attachments to another system. These attachments will be located to a parent folder, let's say " Folder 0 " (see this question's diagram for better understanding), and they will be zipped/compressed. I want my batch script to be called like so: BatchScript.bat "c:\temp\usd\Folder 0" I'm using 7za.exe as the command line extraction tool. What I want my batch script to do is to iterate through the " Folder 0 "'s subfolders, and