I need a script that will delete all git tags older than two weeks.
The tags all follow the same format 2014-02-22_06-14-57_30
YYYY-MM-DD_HH-mm-SS_B#
YYYY - 4 digit year
MM - 2 digit month
DD - 2 digit day
HH - 2 digit 24 hour time
mm - 2 digit minutes
SS - 2 digit seconds
B# - CI build number which can be ignored
I want the script to take a target repository as a parameter
[login to view URL] {taget-git-repo}
The script must clone the target repo
identify all tags that match the pattern described above
for all tags older than 2 weeks delete the tag and push to the remote repo
This script will run with the ssh configuration setup for the target repo so the script can assume ssh will just work.
Hi,
i can do this for you. i know shell scripting. its a very easy task for me.. i done similar script in the past as part of my work.. award me let's start...
Thanks
rahulsng1
#!/bin/sh
##### conf #####
main_path=your file path dir
################
for name in `ls -1 $main_path`
do
#echo $name
ft=`/usr/bin/stat -c "%Y" $main_path/$name`
#echo $ft
ct=`date +%s`
#echo $ct
dift=`expr $ct - $ft`
#echo $dift
#2 weeks
if [ $dift -gt 86400*14 ]
then
#echo "$name gt"
rm -f $main_path/$name
fi
done
exit 0
push to the remote repo?scp??
i have export script handle scp
please prefer to my bid
I already did a similar Task before where I was required to Automatically Backup a List of GIT/GITHub Repos and to find specific metadata related to some Repo based on Dates, and Author Name. I have no problem to review and test the Final Script with you till you get fully satisfied :).
I provide my IT services to accomplish the software requirements. For additional information check my portfolio or use any available contacts to clarify any issue.