I want to copy few files and folders of last completed build's workspace to current build and then do something with it. I found to do it using free style job with Copy from WORKSPACE of latest completed build option. But I would like to do the same from declarative pipeline script. I got following snipped from snippet generator of Jenkins.
copyArtifacts filter: 'file.xml', projectName: 'NewTestPipeline', selector: workspace(), target: 'out/'
But its not working with pipeline script, says no such file. Note: I am not archiving the artifacts and dont want to archive. I jus need to copy files from last builds workspace.