diff --git a/cmd/restic/cmd_backup.go b/cmd/restic/cmd_backup.go index 290a31ba1..5c4e1b563 100644 --- a/cmd/restic/cmd_backup.go +++ b/cmd/restic/cmd_backup.go @@ -6,6 +6,7 @@ import ( "context" "io/ioutil" "os" + "path/filepath" "strconv" "strings" "time" @@ -301,10 +302,21 @@ func collectTargets(opts BackupOptions, args []string) (targets []string, err er return nil, err } + // expand wildcards + var lines []string + for _, line := range fromfile { + var expanded []string + expanded, err := filepath.Glob(line) + if err != nil { + return nil, err + } + lines = append(lines, expanded...) + } + // merge files from files-from into normal args so we can reuse the normal // args checks and have the ability to use both files-from and args at the // same time - args = append(args, fromfile...) + args = append(args, lines...) if len(args) == 0 && !opts.Stdin { return nil, errors.Fatal("nothing to backup, please specify target files/dirs") }