Created
January 22, 2018 16:17
-
-
Save frayos/3fb7fab3a25c0931c10daab492bf66d5 to your computer and use it in GitHub Desktop.
Change Date Modification time for SDW logs in case of wrong transfer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ################################################## | |
| ################################################## | |
| #FOR SAS DEPLOYMENT WIZARD LOGS ################# | |
| ################################################## | |
| ################################################## | |
| ################################################## | |
| NEWIDR=NEW/ | |
| mkdir $NEWDIR | |
| for i in `ls SDW_sysinfo_*` | |
| do | |
| #SDW_sysinfo_20151006_122839.dat | |
| filename=$(basename "$i") | |
| extension="${filename##*.}" | |
| filename="${filename%.*}" | |
| dateyyyymmdd=`echo $filename |cut -d_ -f3` | |
| timehhmmss=`echo $filename |cut -d_ -f4` | |
| timehhmm="${timehhmmss%??}" | |
| timess="${timehhmmss: -2}" | |
| timestamptouch="$dateyyyymmdd$timehhmm.$timess" | |
| touch -m -t "$timestamptouch" $i | |
| mv $i $NEWDIR | |
| echo $i | |
| done; | |
| exit | |
| for i in `ls | grep -v SDW_sysinfo_` | |
| do | |
| filename=$(basename "$i") | |
| extension="${filename##*.}" | |
| filename="${filename%.*}" | |
| datetocut=`echo "$filename" | cut -d_ -f2` | |
| dateyyyy=`echo "$datetocut" | cut -d- -f1` | |
| datemm=`echo "$datetocut" | cut -d- -f2` | |
| datedd=`echo "$datetocut" | cut -d- -f3` | |
| timehhmmss=`echo "$datetocut" | cut -d- -f4` | |
| timehh=`echo "$timehhmmss" | cut -d. -f1` | |
| timemm=`echo "$timehhmmss" | cut -d. -f2` | |
| timess=`echo "$timehhmmss" | cut -d. -f3` | |
| timestamptouch="$dateyyyy$datemm$datedd$timehh$timemm.$timess" | |
| echo $timestamptouch | |
| touch -m -t "$timestamptouch" $i | |
| mv $i $NEWDIR | |
| done; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment