From 070774c77e20d6356bdae280e35c77eb609c98df Mon Sep 17 00:00:00 2001 From: Björn Mattsson Date: Mon, 6 Mar 2023 10:15:02 +0100 Subject: Move existing file into new dir if needed --- scripts/get-metadata.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/get-metadata.sh b/scripts/get-metadata.sh index 71164cb6..16379681 100755 --- a/scripts/get-metadata.sh +++ b/scripts/get-metadata.sh @@ -68,7 +68,11 @@ entityid=`echo "$metadata" | sed -n 's/.*entityID=['\''"]\([^"]*\)['\''"].*/\1/p entityidfn=`echo "$entityid" | sed 's;.*://;;' | sed 's/[^a-zwA-ZW0-9_.-]/-/g' | sed 's/$/.xml/'` [ -n "$entityidfn" ] || error "Failed to generate filename from entityid $entityid" - +OLDFILE=$(find ../swamid-testing ../swamid-2.0 ../swamid-edugain -name $entityidfn | grep -v $xmldir) +if [ -n "$OLDFILE" ]; then + echo "Moving $OLDFILE into $xmldir" + git mv $OLDFILE $entityidfn +fi [ -r "$entityidfn" ] && new=false || new=true if $new ; then echo -n "Save metadata into $entityidfn [Y/n]? " -- cgit v1.2.3