lsf: add --absolute flag to add a leading / onto path names

This commit is contained in:
Nick Craig-Wood
2018-06-03 10:42:34 +01:00
parent 5302e5f9b1
commit 3ef938ebde
3 changed files with 33 additions and 5 deletions
+12
View File
@@ -24,6 +24,7 @@ var (
filesOnly bool
dirsOnly bool
csv bool
absolute bool
)
func init() {
@@ -36,6 +37,7 @@ func init() {
flags.BoolVarP(&filesOnly, "files-only", "", false, "Only list files.")
flags.BoolVarP(&dirsOnly, "dirs-only", "", false, "Only list directories.")
flags.BoolVarP(&csv, "csv", "", false, "Output in CSV format.")
flags.BoolVarP(&absolute, "absolute", "", false, "Put a leading / in front of path names.")
commandDefintion.Flags().BoolVarP(&recurse, "recursive", "R", false, "Recurse into the listing.")
}
@@ -125,6 +127,15 @@ Eg
test.sh,449
"this file contains a comma, in the file name.txt",6
Note that the --absolute parameter is useful for making lists of files
to pass to an rclone copy with the --files-from flag.
For example to find all the files modified within one day and copy
those only (without traversing the whole directory structure):
rclone lsf --absolute --files-only --max-age 1d /path/to/local > new_files
rclone copy --files-from new_files /path/to/local remote:path
` + lshelp.Help,
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
@@ -149,6 +160,7 @@ func Lsf(fsrc fs.Fs, out io.Writer) error {
list.SetSeparator(separator)
list.SetCSV(csv)
list.SetDirSlash(dirSlash)
list.SetAbsolute(absolute)
for _, char := range format {
switch char {