Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touch: added custom modTime setting #729

Merged
merged 1 commit into from
Sep 11, 2016
Merged

touch: added custom modTime setting #729

merged 1 commit into from
Sep 11, 2016

Conversation

odeke-em
Copy link
Owner

Fixes #726.

Added custom modification time setting with two different modes:

  • Custom time with an optional format specifier
$ drive touch --time 20120202120000 ComedyPunchlineDrumSound.mp3
/share-testing/ComedyPunchlineDrumSound.mp3: 2012-02-02 12:00:00 +0000 UTC
$ drive touch --format "2006-01-02-15:04:05.0000Z" --time "2016-02-03-08:12:15.0070Z" outf.go
/share-testing/outf.go: 2016-02-03 08:12:15 +0000 UTC

The default format specifier is 20060102150405.
The mentioned custom time format has to be relative to how you would represent
"Mon Jan 2 15:04:05 -0700 MST 2006".
See the documentation for time formatting here
time.Parse

  • Custom time offset from the current clock time.
$ drive touch --duration -30h ComedyPunchlineDrumSound.mp3 outf.go
/share-testing/outf.go: 2016-09-10 08:06:39 +0000 UTC
/share-testing/ComedyPunchlineDrumSound.mp3: 2016-09-10 08:06:39 +0000
UTC

To set that file's modTime to 30 hours ago. For allowable
duration formats, see https://golang.org/pkg/time/#Parse.

Fixes #726.

Added custom modification time setting with two different modes:
+ Custom time with an optional format specifier
```shell
$ drive touch --time 20120202120000 ComedyPunchlineDrumSound.mp3
/share-testing/ComedyPunchlineDrumSound.mp3: 2012-02-02 12:00:00 +0000 UTC
$ drive touch --format "2006-01-02-15:04:05.0000Z" --time "2016-02-03-08:12:15.0070Z" outf.go
/share-testing/outf.go: 2016-02-03 08:12:15 +0000 UTC
```
The default format specifier is 20060102150405.
The mentioned custom time format has to be relative to how you would represent
"Mon Jan 2 15:04:05 -0700 MST 2006".
See the documentation for time formatting here
[time.Parse](https://golang.org/pkg/time/#Parse)

+ Custom time offset from the current clock time.
```shell
$ drive touch --duration -30h ComedyPunchlineDrumSound.mp3 outf.go
/share-testing/outf.go: 2016-09-10 08:06:39 +0000 UTC
/share-testing/ComedyPunchlineDrumSound.mp3: 2016-09-10 08:06:39 +0000
UTC
```
To set that file's modTime to 30 hours ago. For allowable
duration formats, see https://golang.org/pkg/time/#Parse.
@odeke-em odeke-em merged commit a32b9e3 into master Sep 11, 2016
@odeke-em odeke-em deleted the touch-time-changer branch September 17, 2016 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant