r/Batch • • Sep 22 '26

Recursive option with 7zip

How does recurse work on 7zip CMD line ?

2 Upvotes

18 comments sorted by

2

u/pc1350 Sep 22 '26

Check help file. Very useful. 

2

u/Equivalent_Meaning46 Sep 22 '26

I tried to use -r- but it still recurse for some reason 

2

u/capoapk Sep 22 '26

C'est un piège très classique avec 7-Zip

2

u/Equivalent_Meaning46 Sep 22 '26

English plz

1

u/capoapk Sep 22 '26

Here is my compression software

1

u/Equivalent_Meaning46 Sep 22 '26

does it preserve timestamps ? such as date created, date modified etc..

1

u/capoapk Sep 22 '26

Pour chercher des fichiers précis partout (par exemple, tous les ⁠.txt⁠), ajoutez simplement ⁠-r⁠ à la fin de la commande

1

u/Equivalent_Meaning46 Sep 22 '26

English please 

1

u/capoapk Sep 22 '26

To search for specific files everywhere (for example, all ⁠.txt⁠), simply add ⁠-r⁠ at the end of the command

1

u/Equivalent_Meaning46 Sep 22 '26

What if I dont want to recurse from a particular folder ? How to use ?

1

u/capoapk Sep 22 '26

7z a archive.7z MonDossier\ -x!MonDossier\DossierAExclure\

1

u/Equivalent_Meaning46 Sep 22 '26

But this only excludes one particular named folder what about all subfolders ??

1

u/capoapk Sep 22 '26

7z a archive.7z C:\MonDossier\* -x!*\

1

u/Equivalent_Meaning46 Sep 22 '26

Do I have to use 7z a archive.7z C:\MonDossier\* -x!*\ or can I use 7z a archive.7z C:\MonDossier -x!*\ ???

2

u/[deleted] Sep 22 '26

[removed] — view removed comment

1

u/Equivalent_Meaning46 Sep 22 '26

Believe me, I have looked non stop everywhere and tried every possible combination of switches and posted on 7zip sourxeforge page too, the author's English is very bad and he does not communicate well about why he chose recurse to behave the way he wants to it's reaaaally counterintuitive 

3

u/BrainWaveCC Sep 22 '26

You would undoubtedly find it far more productive if you told us exactly what you were trying to accomplish -- the in the weeds version, not the 30,000 foot version -- and we could probably give you an answer without running to almost 20 responses.

I've done lots of recursion with 7zip, and knowing what you are trying to do would be better than answering generically about a feature that actually exists.