Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.commons.io.FileUtils
- import org.apache.tools.ant.util.FileUtils
- import java.nio.file.Files
- import java.nio.file.Paths
- import java.util.zip.ZipFile
- def path = 'C:\\Tickets\\...\\'
- def s = '.xml'
- def unzipFile(File file) {
- cleanupFolder()
- def zipFile = new ZipFile(file)
- zipFile.entries().each { it ->
- def path = Paths.get('c:\\Tickets\\' + it.name)
- if(it.directory){
- Files.createDirectories(path)
- }
- else {
- def parentDir = path.getParent()
- if (!Files.exists(parentDir)) {
- Files.createDirectories(parentDir)
- }
- Files.copy(zipFile.getInputStream(it), path)
- }
- }
- }
- private cleanupFolder() {
- FileUtils.deleteDirectory(new File('c:\\folder\\'))
- }
- String fileContents = new File(path).text
- def Violations = new XmlSlurper().parseText(fileContents)
- println Violations.Violation.@'OBJ_SIZE'
- size=Violations.Violation.@'OBJ_SIZE'
- if (size==1){
- def file = new File('ะก:/Directory1')
- file.mkdir()
- } else {def file = new File('ะก:/Directory2')
- file.mkdir()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement