Created
December 7, 2011 15:22
-
-
Save siwells/1443197 to your computer and use it in GitHub Desktop.
OMERO: Delete OriginalFiles Script
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 | |
| OriginalFileName="TypeA" | |
| RAWFILE="/tmp/$(basename $0).$$.raw.tmp" | |
| PREPFILE="/tmp/$(basename $0).$$.prep.tmp" | |
| LOGFILE="$(basename $0).$$.log" | |
| # Retrieve data | |
| omero hql -q --limit=1000 "select name, id from OriginalFile where name = '$OriginalFileName'" > $RAWFILE | |
| # Prepare data, we want a file with on OriginalFile id per line | |
| tail -n +3 $RAWFILE | sed '$d' | cut -d "|" -f 3 > $PREPFILE | |
| # Do the deletion | |
| while read line | |
| do | |
| echo "deleting the OriginalFile with id: $line" | |
| # omero delete /OriginalFile:$line # KEPT COMMENTED OUT FOR SAFETY | |
| done < "$PREPFILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment