Skip to content

Instantly share code, notes, and snippets.

@geta6
Created December 17, 2012 15:24
Show Gist options
  • Save geta6/4319091 to your computer and use it in GitHub Desktop.
Save geta6/4319091 to your computer and use it in GitHub Desktop.
mtimeをfixします
#!/bin/zsh
if [ -z $1 ]; then
echo 'Usage: mtimefix [dirname:/dir/name/here]'
exit 1
fi
if [ -d $1 ]; then
for DIR in $1/*
do
if [ -d $DIR ]; then
FILE=/`find $DIR -type f -print0 | xargs -0 ls -l --time-style=long-iso | sort -k 6,7 | tail -1 | cut -d'/' -f2-`
#echo $FILE
touch -r $FILE $DIR
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment