7z to make archive with subdirectories

Hey all,

I have a series of directories, containing subdirectories, containing a mix of files and I only want to archive the .txt files from within. I'd like that archive to maintain the directory structure so I create a 7z file that contains the same directory structure and can be simply copied over the same structure and update the text files. It seems like that should be possible, but I don't quite see how to do it (and I don't script). I guess the simplest way might be to produce a text file of all the text files including their paths and edit that to produce a commandline version script for 7z?

Thanks for any help,

B

Turn on the Copy Filter option in the drop-down attached to the Copy Files button.

Create the archive as you would normally (e.g. right-click the folder and choose Add to FolderName.7z).

Opus should prompt you for the filter. Set it to Name Match *.txt, use wildcards.

That's it. :slight_smile:

Wow, that sounds too good to be true! Hmm, the Copy Filter button didn't do anything, 7z made an archive of everything really quickly, but it was the complete folder.

B

On the other hand... doing a zip is fine :slight_smile:

B

And it rocks so hard! That's brilliant, thanks Leo, and thank you to Jon and Greg for providing this in the first place :slight_smile:

B

Are you using Opus to make the 7z archive, or 7-Zip itself? The copy filter only affects Opus, when using the built-in 7z support.

Opus. Only having a zip is no big deal - it's not a huge file.

B

FWIW, It definitely works with 7z here as that's what I tried with.