I'm trying to use a backslash on the command bellow at groovy syntax:
find /path/folder-* -type f -iname "file*" -exec rm -f {} \;
When I try to build this command on a Jenkins pipeline give me an error about this syntax. Even before I do this command have a warning with red syntax on Jenkins form field saying unexpected char: '\'.
What could I do for replace or fix error with this backslash ?
Groovy commands:
node ("instance") {
stage ("cleaning folders"){
sh '''
find /root/logfiles/instance* -type f -iname "file*" -exec rm -f {} \;
'''
}
stage ("instance1"){
sh '''
rm -f /root/logfiles/instance1/*
echo instance1;
scp 100.0.0.50:/var/log/file1.log /root/logfiles/instance1/file1.log;
scp 100.0.0.50:/var/log/file2.log /root/logfiles/instance1/file2.log;
'''
}
stage ("instance1"){
sh '''
rm -f /root/logfiles/instance2/*
echo instance2;
scp 100.0.0.51:/var/log/file1.log /root/logfiles/instance2/file1.log;
scp 100.0.0.51:/var/log/file2.log /root/logfiles/instance2/file2.log;
'''
}
}
Notice: I have rm -f for all instances at this moment. Will substitute all rm -f to the find command on the stage cleaning folders.
Tks in advance