Need command to delete particular folder before deploying

Hi Team
After jenkins build ,I am trying to push build folder from jenkins to destination uisng below pipeline command.
stage(‘Upload to server’) {
def deployStatus = “”
try {

        ws(this.WORKSPACE_PATH) {
            continueOnError: false, 
            failOnError: true,
            publishers: [
                    configName: 'nuvamaprivate', 
                    verbose: true,
                    transfers: [
                            cleanRemote: true,
                            flatten: false, 
                            makeEmptyDirs: true, 
                            noDefaultExcludes: false, 
                            patternSeparator: '[, ]+', 
                            remoteDirectory: '/', 
                            remoteDirectorySDF: false, 
                            removePrefix: '', 
                            sourceFiles: 'build/**/*'

Here in the above pipeline where i use cleanRemote : true , :-Its deleting all the folder
I need command where i can delete specific build folder.

Any reason you are using ssh publisher instead of just using sh(‘rsync’)

Rsync is very good at transfering files. And can delete any remote files that are not local.

1 Like