Skip to content

Instantly share code, notes, and snippets.

@dfreniche
Last active December 20, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfreniche/6090995 to your computer and use it in GitHub Desktop.
Save dfreniche/6090995 to your computer and use it in GitHub Desktop.
A small bash script to find all files with wrong date (1 Jan 1970) and set to current date. Tested in Mac (OS X 10.8) but should work in other UNIXes
#!/bin/bash
#update-date.sh: a small script to find all files with wrong date (1 Jan 1970) and set to current date
COMP_FILE=$HOME/comp_file_delete_me
touch -t 197001020101 $COMP_FILE
echo Comparing with $COMP_FILE
echo Obtaining list of files with wrong date. Will take some time…
find ./ -depth -type f -not -newer $COMP_FILE -print -exec touch {} \;
rm $COMP_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment