Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:\
---+ JENKINS
------+ PLUGINS
------+ JOBS
----------+ JOB_1
--------------+ BUILDS
------------------ file1
------------------ file2
------------------ file3
--------------- file1
--------------- file2
--------------- file3
--------------- config.xml
share|improve this question
    
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 '13 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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