Skip to content

donuts-are-good/timestamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

donuts-are-good's followers donuts-are-good's stars donuts-are-good's visitors

timestamp

a tool to view and modify timestamps

usage

you can view timestamps and/or rewrite them, so the --modify flag is optional

timestamp [--modify] /path/to/file

without the --modify flag, timestamp will display the timestamps of the specified file. with the --modify flag, you'll be asked interactively for new timestamps and it'll confirm before any changes are made.

examples

  1. show timestamps

to only show the timestamps of a file, run timestamp with the path to the file as an argument:

$ timestamp /path/to/file.txt

this will show the current, created, and modified timestamps of the file.

  1. modify timestamps to modify the timestamps of a file, use the --modify flag:
$ timestamp --modify /path/to/file.txt

this will start an interactive prompt where you can enter new timestamps.

here's what the prompt process looks like:

enter the new created timestamp
(format: RFC3339, ex: '2006-01-02T15:04:05Z07:00')
or leave it blank to use the current time): <put your timestamp here>

enter the new modified timestamp
(format: RFC3339, ex: '2006-01-02T15:04:05Z07:00')
or leave it blank to use the current time): <put your other timestamp here>

You entered:
New created timestamp: 2023-05-12T10:30:00Z
New modified timestamp: 2023-05-12T11:30:00Z
Are you sure you want to proceed with these changes? (yes/no): <if you just press enter, it should quit>

enter the new timestamps in the example format or leave it blank to use the current time, then confirm it by typing yes.

that's it :)

note

i couldn't find a way to get file creation time in mac and unix systems. if you can do that, please pr it or make an issue if you have time.

license

MIT License 2023 donuts-are-good, for more info see license.md