Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

Plugin Information

View File Operations on the plugin site for more information.


This plugin's main goal is to provide File Operations as Build Step.

Following Operations implemented:

1) File Copy Operation

2) File Delete Operation

3) File Create Operation

4) File Download Operation

5) File Transform Operation

6) File UnTar Operation

7) File UnZip Operation

8) Folder Create Operation

9) Folder Copy Operation

10) Folder Delete Operation

11) File Join

12) File Properties To Json

13) File Zip Operation

14) File Rename Operation

15) Folder Rename Operation

This will be helpful for doing cross platform file operations. No need to search for Nix or Win commands to do file operations.


Release 1.7 (4 September 2017)

  • Added File Rename Operation
  • Added Folder Rename Operation

Release 1.6 (4 May 2017)

  • Fixed download failed due to empty credentials even though if it open for public

Release 1.5 (7 April 2017)

  • Added File Zip Operation

Release 1.4 (5 March 2017)

  • Added Symbols for Jenkins pipeline

Release 1.3 (3 October 2016)

  • Added Job DSL support

Release 1.2 (26 June 2016)

  • Added 11 & 12 operations

Release 1.1 (28 May 2016)

  • Added support for pipeline

Release 1.0 (22 April 2016)

  • First public release with 1 to 10 operations


  1. Unknown User (slavik334)


    could you please add to the manual how to use plugin in pipeline?


  2. Unknown User (andrewsumner)

    1. Can this be used to copy files from outside the workspace? When using as a build step I got:

    Got: Expecting Ant GLOB pattern, but saw 'C:/Temp/*.xml'

    2. How do I use this in a Jenkins Pipeline / Jenkinsfile script? (I assume that's what you mean by DSL)

    Using as documented

    freeStyleJob('FileOperationsJob') {
        steps {
            fileOperations {

    Results in:

    java.lang.IllegalArgumentException: Expected named arguments but got [FileOperationsJob, org.jenkinsci.plugins.workflow.cps.CpsClosure2@edf76f]

    Using inside my script

    node {
        fileCopyOperation('C:\\Temp\\*.xml', '', '.', false)

    Results in:

    java.lang.NoSuchMethodError: No such DSL method 'fileCopyOperation' found among steps [...
    1. Unknown User (pskumar448)

      step([$class: 'FileOperationsBuilder', fileOperations: [[$class: 'FileCopyOperation', excludes: '', flattenFiles: false, includes: '**/*.xml', targetLocation: '.']]])

      To FileOperations in Jenkins Pipeline, above is the syntax for FileCopyOperation. The above code can be generated using pipeline-syntax.

    2. Unknown User (pskumar448)

      1. Unknown User (krsanjeev83)

        fileOperations ([
        fileCopyOperation (includes: "${WORKSPACE}/${PROJECT_NAME}/**",  targetLocation: "${WORKSPACE}/${PROJECT_NAME}-build/source")

        I want to copy all file from ${WORKSPACE}/${PROJECT_NAME}/ to ${WORKSPACE}/${PROJECT_NAME}-build/source but its not working. 

        If I try "includes: "**/${PROJECT_NAME}/**" it will create a directory {PROJECT_NAME} inside the target folder 

        Thanks in advance


  3. Unknown User (alekseygorbunov)


    Can this plugin rename the files and folders?.

    Can you can add this feature?


  4. Unknown User (bdrc)

    Greetings, I have downloaded the latest version of the plugin, and could not find Zip feature in the operations list. 

    Is it consolidated into File Join operation? 

  5. Unknown User (johannsig)

    Could you please allow for greater control in how the File Zip archives a directory? I want the contents of my target folder to end up in the ZIP file's root directory, like \{MyFilesAndSubDirectories} - not \{MyFolder}\{MyFilesAndSubDirectories}.

    I wouldn't normally ask but I have no other easy way to achieve this with Jenkins in Windows than by using your fine plugin.

    1. Unknown User (pskumar448)

      Raise ticket in JIRA with requirement description.

  6. Unknown User (demonicdaron)

    I am trying to create a file using you plugin as follows:

    fileOperations({ fileCreateOperation('appspec.json', 'test content') })

    But I get the following errors:
    WorkflowScript: 32: Missing required parameter: "fileOperations" @ line 32, column 6.
    fileOperations({ fileCreateOperation('appspec.json', 'test content') })

    WorkflowScript: 32: Arguments to "fileCreateOperation" must be explicitly named. @ line 32, column 23.
    fileOperations({ fileCreateOperation('appspec.json', 'test content') })
    I also tried the following:

    fileOperations([ fileCreateOperation('appspec.json', 'test content') ])

    But I get the following error:

    java.lang.IllegalArgumentException: Expected named arguments but got [appspec.json, test content]

    Am I doing something wrong?

    1. Unknown User (demonicdaron)

      I solved the issue by using the following syntax:

      fileOperations([ fileCreateOperation(fileName:'appspec.json', flieContent:'test content') ])

      The documentation for this plugin really needs to be updated: https://github.com/jenkinsci/file-operations-plugin 

  7. Unknown User (joamla)

    I need some help regarding deleting files in Windows.

    I have created a step with the following:

    fileOperations([fileCopyOperation(excludes: '', flattenFiles: true, includes: 'website/app_offline_template.htm', targetLocation: 'C:\\www\\release'), fileRenameOperation(destination: 'C:\\www\\release\\app_offline.htm', source: 'C:\\www\\release\\app_offline_template.htm')])

    fileOperations([fileDeleteOperation(excludes: '', includes: 'C:\\www\\release\\app_offline.htm')])


    Step 1 works fine, copies the file and renames is.

    step 2, deleting gives me this error: FATAL: Expecting Ant GLOB pattern, but saw 'C:\www\release\app_offline.htm'. See http://ant.apache.org/manual/Types/fileset.html for syntax

    I have also tried with \\app_offline* and other variations

    1. Unknown User (joamla)

      Even like: 

      FATAL: Expecting Ant GLOB pattern, but saw '/www/release/app_offline.htm'. See...
    2. Unknown User (joamla)

      Current workaround:

      Create folder, move file there, remove folder:

      fileOperations([folderCreateOperation('/www/release/old'), fileRenameOperation(destination: '/www/release/old/app_offline.htm', source: '/www/release/app_offline.htm'), folderDeleteOperation('/www/release/old/')])

      1. Unknown User (swf)

        Stuck on the same problem and the current example is just wrong. 

        Anyway, thx for the workaround!

      2. Unknown User (modle13)

        This seems to defeat the purpose. Why not just `sh "cp /from/file /to/file"` and be done?

  8. Unknown User (britnoth991)

    How can I use fileOperations like folderCreateOperation in the steps block a declarative pipeline? I have tried implementations using various syntaxes, but I can't get any to work.

    I have also tried using a script block in my declarative pipeline steps block with the scripted examples above and elsewhere. I can't get these to work either. For example when I try:

    steps {

                   script {

                       step([$class: 'FileOperationsBuilder', fileOperations: [[$class: 'folderCreateOperation', folderPath: 'build']]])



    I get:

    "Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node"

    I am not helped by being new to Jenkins and groovy...

    1. Unknown User (swf)

      stage('Build') {
      	agent {
      		label "foo"
      	steps {
      		script {
      							password: '',
      							targetFileName: 'foo.zip',
      							targetLocation: "${WORKSPACE}",
      							url: 'https://foobar.com/foo.zip',
      							userName: ''),
      							filePath: 'foo.zip',
      							targetLocation: '.'),
      							destinationFolderPath: 'dest',
      							sourceFolderPath: 'foo/content'),
      1. Unknown User (krsanjeev83)

        I tried to Use FileOperations in my Jenkinsfile but still facing same error, is there any prerequisite to use this plugin

        stage("FileOperation") {
        steps {
        script {

        1. Unknown User (swf)

          As written in my example above, you should use just ${WORKSPACE} instead of ${env.WORKSPACE} because it's not an environment variable. I'm using it this way and it works like a charm:

          source: "${WORKSPACE}/bin",
          destination: "${WORKSPACE}/delivery"
          folderPath: "${WORKSPACE}/old"
          1. Unknown User (krsanjeev83)

            Thanks Yves,

            It worked fine for me, one  more query I have. How I could have multile value of 

            folderPath: value1 value2 ... value2

            Thanks in advance

  9. Unknown User (xiaoyao9184)

    i cant rename file or folder on windows system and use with dir also cant rename

    [Pipeline] echo
    [Pipeline] echo
    [Pipeline] dir
    Running in D:/Program/ETL/[Deploy]DataCenter_20181120_152313_ed9c470/DataCenter/.profile
    [Pipeline] {
    [Pipeline] step
    File Rename Operation:
    FATAL: null
    FATAL: null

  10. Unknown User (jielpe_fr38)

    I confirm that fileRenameOperation does not work for me too. And I think there is a critical problem.
    Ok, my source and destination are not in the Workspace. But:

    • I think it should not be limited to files in Workspace
    • The error message should give more explanations
    • And  most important !
      It should either not work at all if not on the workspace or do what it is expected to do.

      Currently, working on files and folders outside the directory, if the destination is a file name, it fails. But if the destination is a directory, it silently remove the directory and replace it with a file !!!

  11. Unknown User (psvob)


     I have a problem that fileCopyOperation doesn't accept full path in includes (throwing not a valid GLOB pattern exception). I want to have several fileCopyoperations to copy files from workspace to dedicated directory which

    step {
        dir ("test_dir") {
               fileCopyOperation(includes:"${workspace}/test.txt", targetLocation: "", flattenFiles: true),

      I'd appreciate to have an option to use absolute path in includes or have another parameter for such operations next to includes.


  12. Unknown User (krsanjeev83)

    Please try 

    fileCopyOperation(includes:"${env.WORKSPACE}/test.txt", targetLocation: "", flattenFiles: true)

    Also please specify the targetlocation like "argetLocation: "${env.WORKSPACE}/test_dir"

  13. Unknown User (orennu)

    hi there ,

    maybe i am way off, but i am trying to use this plugin to copy folder from master to slave machine.

    here is snippet from my jenkinsfile

    stage ('copy test code') {
    agent { label 'slave' }
    options {
    skipDefaultCheckout true
    steps {
    script {
    destinationFolderPath: "${WORKSPACE}\\test_code",
    sourceFolderPath: "${JENKINS_HOME}/workspace/copytoslave"

    is this possible with this plugin? if so what am I missing?