ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA - Compress files with 7zip without the folder

<< < (2/2)

lanux128:
i don't think there is such an option with 7z. here are the options from the command-line tool:
cmd-line options7-Zip 4.40 beta  Copyright (c) 1999-2006 Igor Pavlov  2006-05-01

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
       [<@listfiles...>]

<Commands>
  a: Add files to archive
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths

<Switches>
  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -t{Type}: Set type of archive
  -v{Size}[b|k|m|g]: Create volumes
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries


and an online example here.

ewemoa:
IIUC, I had a similar difficulty trying to package a plugin for FARR.

What I ended up doing was to have an initial step of cd-ing in to the folder containing what I wanted to have compressed (as mentioned by SirSmiley) and also to have the resulting file created outside of the folder containing the contents to be compressed.  What follows is a sketch with some details.

If "test" is the name of the folder containing things to compress, the following is the sort of command line that worked for my case (assuming I run the command in the parent folder of "test"):


--- ---cd test && 7z.exe a -tzip ..\test.zip -r .\*

To verify the results, I used the Open menu item in the File menu of 7-zip File Manager on the test.zip file -- I also extracted the test.zip file using the "7-zip" -> "Extract Here" menu item from the Windows Explorer context menu successfully.  The version of 7-zip I am using appears to be 4.5.7.

I tried basically what SirSmiley mentioned w/ success too:


--- ---c:\test>7za.exe a test.7z -r *

The result was a test.7z file in my C:\test folder -- I also verified its contents using the two methods mentioned above.

rookie1:
thank u SirSmiley, lanux128 and Ewemoa

im new to this and it is the last step of a larger  (fist time) script i am making

first it unpacks a 7z file in a folder, than it removes some files en than replace some files.

and than sould be packet again as it was.(a .cab would be fine to)

with Your information above i must get it write :-) i am going to work on it!

 i must stil be doing something wrong....

Kind regards

rookie1:
Code:
cd test && 7z.exe a -tzip ..\test.zip -r .\*
--- End quote ---

worked great, Jippie I'm very happy now. :-D
But how do I specify where the 7za.exe file is located?

cd test && prog\7za.exe a -t7z ..\test\ -r .\*         is not working

edit: Good cd test && ..\prog\7za.exe a -t7z ..\test -r .\* Good   WORKS!!

the script must be used on a system where maybe there's no 7zip installed
In the mean time I'll keep searching, you already helped me a lot

Thanx Again


Navigation

[0] Message Index

[*] Previous page

Go to full version