Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For instance, if I wanted to zip everything in My Documents, but not subfolders in My Documents, and I also did not know the name of each subfolder.

share|improve this question
up vote 1 down vote accepted

Open a command prompt and if 7-Zip is not in your path, navigate to the directory with the 7-Zip files, then type:

7z.exe a C:\mydocs.7z -r- %userprofile%\documents\*.*

This just zips all in files in documents but not any subfolders.

If you are using a Pre-Vista Windows, the example above may not work unless you have a 'documents' folder in your home directory.

The 7-Zip help file has examples for all the command line options.

share|improve this answer
    
And if you are using a Post-XP Windows, the example above will result in mydocs.7z ending up in %LocalAppData%\VirtualStore due to UAC and especially Virtualization (since even Admin users have no rights to write to the root dir i.e. C:). – Karan Feb 23 '13 at 18:27
    
@Karan - Correct, I just wanted to give a short example. Still, I always have an elevated command prompt open where the example works fine. – Peter Hahndorf Feb 23 '13 at 19:02
    
Yep, an elevated cmd prompt will do the trick. Nothing wrong with the example though, was just an add-on comment (since you mentioned a Pre-Vista caveat yourself). – Karan Feb 23 '13 at 19:06
    
Well, it runs into problems if you have files named without extensions such as README or LICENSE, but for most normal directories this works fine. – NobleUplift Oct 25 '13 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .