Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.