aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-07-13 23:17:41 -0700
committerChris Lu <chris.lu@gmail.com>2013-07-13 23:17:41 -0700
commitd9c25ccbb0b0e9ddc3189a097177099a35a09052 (patch)
tree6d37289544e6a32c7e59a57f23a2be1d176c182a /go
parentddf4f27a564886e402f507efe03518b9f4fcf61c (diff)
downloadseaweedfs-d9c25ccbb0b0e9ddc3189a097177099a35a09052.tar.xz
seaweedfs-d9c25ccbb0b0e9ddc3189a097177099a35a09052.zip
upload files recursively matching a pattern
Diffstat (limited to 'go')
-rw-r--r--go/weed/upload.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/go/weed/upload.go b/go/weed/upload.go
index 2e3a3f4b1..9d9a02527 100644
--- a/go/weed/upload.go
+++ b/go/weed/upload.go
@@ -16,6 +16,7 @@ import (
var (
uploadReplication *string
uploadDir *string
+ include *string
)
func init() {
@@ -23,6 +24,7 @@ func init() {
cmdUpload.IsDebug = cmdUpload.Flag.Bool("debug", false, "verbose debug information")
server = cmdUpload.Flag.String("server", "localhost:9333", "weedfs master location")
uploadDir = cmdUpload.Flag.String("dir", "", "Upload the whole folder recursively if specified.")
+ include = cmdUpload.Flag.String("include", "", "pattens of files to upload, e.g., *.pdf, *.html, ab?d.txt, works together with -dir")
uploadReplication = cmdUpload.Flag.String("replication", "000", "replication type(000,001,010,100,110,200)")
}
@@ -127,6 +129,11 @@ func runUpload(cmd *Command, args []string) bool {
filepath.Walk(*uploadDir, func(path string, info os.FileInfo, err error) error {
if err == nil {
if !info.IsDir() {
+ if *include != "" {
+ if ok, _ := filepath.Match(*include, filepath.Base(path)); !ok {
+ return nil
+ }
+ }
results, e := submit([]string{path})
bytes, _ := json.Marshal(results)
fmt.Println(string(bytes))