Skip to content

Instantly share code, notes, and snippets.

@pas-calc
Created April 15, 2021 17:28
Show Gist options
  • Save pas-calc/c58df75a8482cfc564ea5197c7f97121 to your computer and use it in GitHub Desktop.
Save pas-calc/c58df75a8482cfc564ea5197c7f97121 to your computer and use it in GitHub Desktop.
append last changed date to end of file without changing timestamp
f="filename.ext"; echo "file='$f'"; d=$(stat -c %y "$f" | cut -c-19); echo "modified=$d"; echo -en "\n$d" >> "$f"; touch -d "$d" "$f"; ls -al "$f"
Do 15 Apr 2021 19:26:30 CEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment