touch: add support for touching files in directory, with options for recursive, filtering and dry-run/interactive

Fixes #5301
This commit is contained in:
albertony
2021-05-22 21:06:24 +02:00
parent 2e72ec96c1
commit 41876dd669
4 changed files with 132 additions and 48 deletions

View File

@@ -3,7 +3,6 @@ package touch
import (
"context"
"testing"
"time"
_ "github.com/rclone/rclone/backend/local"
"github.com/rclone/rclone/fs"
@@ -16,11 +15,7 @@ var (
)
func checkFile(t *testing.T, r fs.Fs, path string, content string) {
layout := defaultLayout
if len(timeAsArgument) == len(layoutDateWithTime) {
layout = layoutDateWithTime
}
timeAtrFromFlags, err := time.Parse(layout, timeAsArgument)
timeAtrFromFlags, err := timeOfTouch()
require.NoError(t, err)
file1 := fstest.NewItem(path, content, timeAtrFromFlags)
fstest.CheckItems(t, r, file1)