Yozmo
Yozmo

Reputation: 581

Copy content of a directory to another Jenkins pipeline

I'm trying to copy the content of a directory into another directory on a Jenkins file. My first attempt was using xcopy, but I'm getting an error ( Invalid number of parameters).

bat 'xcopy cashplus-backoffice/cashplus-backoffice-ui/build/web cashplus-backoffice/src/main/resources/static /e /h'

My second attempt was to using File Operation plugin as follows:

                fileOperations([fileCopyOperation(
                   excludes: '',
                   flattenFiles: false,
                   includes: 'cashplus-backoffice/cashplus-backoffice-ui/build/web/**',
                   targetLocation: 'cashplus-backoffice/src/main/resources/static'
                )])

The problem with this solution is that it copy the whole tree and the content of the source folder ( cashplus-backoffice/cashplus-backoffice-ui/build/web. I want just the content of the web folder ). How can I achieve this?

Upvotes: 0

Views: 698

Answers (1)

Altaf
Altaf

Reputation: 3076

You can use xcopy command and use \\ instead of \ for windows.
Example:

bat "xcopy /E /H C:\\Data\\myfiles C:\\Data\\Documents\\"

Upvotes: 1

Related Questions