github.com/gkstretton/dark/services/goo@v0.0.0-20231114224855-2d1a2074d446/scripts/get-creation-timestamp (about)

     1  #!/bin/bash
     2  # returns the creation date and time of the file $1 in fractional seconds
     3  # since epoch
     4  
     5  # Get string timestamp, without timezone
     6  str=$(stat -c %w $1 | sed "s/ +....//g")
     7  # Turn this into [seconds].[nanos], printing to stdout
     8  date -d "$str" '+%s.%N'