I have a Jenkins Server which I want to Backup using 7-zip.

I want to backup the full C:\JENKINS with all the sub directories with only one exception. The exception is that from the JOBS folder I only want to backup the config.xml files. There is a config.xml file for each "Child" folder (such as "JOB_1" in the example below) of the "Parent" JOBS folder.

An example of the Directory Structure is:

+ C:\
------+ PLUGINS
------+ JOBS
----------+ JOB_1
--------------+ BUILDS
------------------ file1
------------------ file2
------------------ file3
--------------- file1
--------------- file2
--------------- file3
--------------- config.xml
  • One way if it's supported might be to exclude the JOBS folder on first pass, then add only the XMLs under it on the next pass and update the archive.
    – Karan
    Apr 18, 2013 at 15:42

1 Answer 1


Without multiple passes as I mentioned above, the following is the closest I got:

7z a Backup.7z .\Jenkins\* -xr!Jobs -ir!.\Jenkins\Jobs\config.xml

Run that command from C:\ and you'll end up with all the files you want in the archive. Only minor problem is that the directory structure in the archive will not be:

------+ PLUGINS
------+ JOBS
----------+ JOB_1
--------------- config.xml

Instead you'll end up with:

------+ PLUGINS
------+ JOB_1
----------- config.xml

Thus after extracting and during data restoration you'll need to (manually or using a script) take all the JOB_n directories and move them inside the JOBS directory on the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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