update mtime on files as we write them.

This commit is contained in:
Stephen McQuay 2016-05-22 09:50:37 -07:00
parent 53b1be748a
commit c2c01c46f1
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D

View File

@ -41,6 +41,10 @@ func (m Media) Move(root string) error {
return fmt.Errorf("trouble copying file: %v", err) return fmt.Errorf("trouble copying file: %v", err)
} }
if err := os.Chtimes(content, time.Now(), m.Time); err != nil {
return fmt.Errorf("couldn't chtimes for %q: %v", content, err)
}
year := fmt.Sprintf("%04d", m.Time.Year()) year := fmt.Sprintf("%04d", m.Time.Year())
month := fmt.Sprintf("%02d", m.Time.Month()) month := fmt.Sprintf("%02d", m.Time.Month())
ts := fmt.Sprintf("%d", m.Time.UnixNano()) ts := fmt.Sprintf("%d", m.Time.UnixNano())