How can I compress multiple files to multiple zip using 7-ZIP?

1

for example I have one folder which contains below mentioned files:

001.txt
001.doc
002.txt
002.doc
003.txt
003.doc
Continue....

I want all similar file names each in separate zip. e.g.

001.zip Contains (001.txt, 001.doc)
002.zip Contains (002.txt, 002.doc)
003.zip Contains (003.txt, 003.doc)

and similarly all files are zipped separately

I am using winrar & 7zip to zip the files.

Andy De

Posted 2016-06-01T12:22:11.770

Reputation: 11

This sounds like a scenario for Powershell. – Bort – 2016-06-01T13:59:33.237

Answers

0

Create a new directory "001" Move 001.txt and 001.doc in this directory and then compress "001"

Mukesh Jagani

Posted 2016-06-01T12:22:11.770

Reputation: 357

1What if there were 20,000 files? The solution doesn't scale well – Joe Taylor – 2016-06-01T12:32:13.550

Correct, but the initial question was not about scaling :) – Mukesh Jagani – 2016-06-01T12:36:48.137

The line; Continue.... at the bottom suggests that there are a lot more than juts the one's he's included as an example. – Joe Taylor – 2016-06-01T12:59:30.853

Hassan, your solution is perfect. 1 up vote for it. Sorry but I could not give it as 15 reputation is required for up vote. – Mukesh Jagani – 2016-06-01T15:27:59.113

0

If using Linux OS:
1. create a file.sh.
2. copy these commands in the file. (set your last_number)
3. execute in terminal: sh file.sh

#!/bin/bash
last_number=<set_your_number>
for i in $(seq 1 $last_number)
    do
        find . -iname "*$i.*" | awk -F / '{print $2}' | tar -cf $i.tar -T -
    done

HP_perfect

Posted 2016-06-01T12:22:11.770

Reputation: 25