Created
August 13, 2014 12:47
-
-
Save tamirko/e054504edd2c39515870 to your computer and use it in GitHub Desktop.
deleteDummyFiles custom command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"deleteDummyFiles" : { prefix, xFiles -> | |
def p = ~/$prefix.*\.txt/ | |
def counter=0 | |
def howManyfiles = xFiles.toInteger() | |
println "Deleting ${howManyfiles} .txt files '${prefix}*' in ${dummyFilesFolder} ..." | |
new File(dummyFilesFolder).eachFileMatch(p) {f -> | |
if ( counter < howManyfiles ) { | |
counter++ | |
println "Deleting file #${counter} ${f.getName()} ..." | |
f.delete() | |
} | |
} | |
println "Done deleting all .txt files in ${dummyFilesFolder} " | |
return "Done" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment