Bash scripts
		
		
		
		
		
		Jump to navigation
		Jump to search
		
		
	
Various scripts...
Reset date
I set the year to 2008 in 2009 on my camera my mistake, this script changes file timestamps from 2008 to 2009:
#!/bin/bash
# file is $1
YEAR=`date -r $1 +%Y` 
if [ $YEAR -eq 2008 ];
  then echo "2008 file: $1"
  OLD_MONTH=`date -r $1 +%m`
  OLD_DAY=`date -r $1 +%d`
  OLD_HOUR=`date -r $1 +%k`
  OLD_MIN=`date -r $1 +%M`
  touch -t 09$OLD_MONTH$OLD_DAY$OLD_HOUR$OLD_MIN $1
fi