Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

WebDav Upload File #11

@tobato

Description

@tobato

hi!

I have try this config to upload files from $buildDir/books

pushArgs {
    user = project.docsUser
    password = project.docsPassword
    url = project.docsRepoUrl
    overwrite = true
    tree = fileTree(dir: "$buildDir/books", include: '**/*.*')
    createDirectoryStructure = true
}

the file in /books

/books
/mybook1
- index.html
- otherfiles...
/mybook2
-index.html

but I can't config the relatvie path of the webdav url like "192.168.1.12:9000/webdav/mybook"
and all the files been upload to 192.168.1.12:9000/webdav/mybook

after search you code, I config the upload task like this

task publishDocs() {
    doLast {
       def antPush = new uk.co.firstzero.webdav.Push()

       antPush.setUser((String)project.pushArgs.user)
       antPush.setPassword((String)project.pushArgs.password)
       antPush.setUrl((String)project.pushArgs.url)
       antPush.setOverwrite((boolean)project.pushArgs.overwrite)

       antPush.setUp()

       project.pushArgs.tree.each {File file ->

           String uploadPath = file.getPath().replace("$buildDir/books", "/books");
           antPush.createDirectory(uploadPath, file.getName());
           boolean result = antPush.uploadFile(file,uploadPath)
           println("Upload status of " + file.getName() + " - " + result);
       }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions