Question

To archive my files I use a bat file with the code:

@set exclude=-x*.bmp -x*.png -x*.jpg
"C:\Program Files (x86)\WinRAR\Rar.exe" a %exclude% "%cd%\MyStuff.rar" ".\MyFolder"

The problem is "MyFolder" is full of junk files and I just want a specific file type like *.txt. And I would like to turn the "exclude" into a "exclude everything except *.txt". How do I do that ?

Was it helpful?

Solution

I just solved it myself. x for exclusion and n for inclusion. Works EXACTLY like I wanted it:

@set exclude=-x*.bmp -x*.png -x*.jpg
@set include=-n*.txt -n*.pdf
"C:\Program Files (x86)\WinRAR\Rar.exe" a %include% "%cd%\MyStuff.rar" ".\MyFolder"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top