/[CCFs]/bin/reset_creation_times
ViewVC logotype

Annotation of /bin/reset_creation_times

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Wed Mar 18 10:17:30 2015 UTC (9 years, 8 months ago) by ccflib
Branch: MAIN
CVS Tags: HEAD
A handy script to reset the modification/creation times of all CCFs to the date they were created as it is written in their FITS headers, plus one day delay between creation and publishing

1 ccflib 1.1 #!/bin/bash
2    
3     # reset_creation_times
4     #
5     # Resets CCF file creation/modification time to the value provided by DATE in its
6     # FITS header.
7     #
8     # $Id$
9    
10     for ccf in `ls -1 *.CCF`
11     do
12     ccf_class=`echo $ccf | cut -d. -f1 | awk -F"_" '{print $1"_"$2}'`
13    
14     [ "$ccf_class" = "XMM_CALINDEX" ] && continue
15    
16     cdate=`fkeyprint $ccf DATE | grep creation | awk -F"'" '{print $2}'| tr "T" " "`
17    
18     cdate=${cdate:0:19}
19    
20     # To add a day delay between upload time and publishing time
21    
22     # To secs since a given date
23    
24     cdatesecs=`date -d "${cdate}" +'%s'`
25    
26     # Add one day delay
27    
28     cdatesecs=$(( $cdatesecs + 86400 ))
29    
30     # Return to std. format
31    
32     cdate=`date -d @${cdatesecs} +'%Y-%m-%d %H:%M:%S'`
33    
34     # Prints original date and changed date
35    
36     echo `ls -l $ccf`
37    
38     touch -m --date="$cdate" $ccf
39    
40     echo `ls -l $ccf` ; echo
41     done

  ViewVC Help
Powered by ViewVC 1.1.27