Skip to content

Instantly share code, notes, and snippets.

@siwells
Created December 7, 2011 15:22
Show Gist options
  • Select an option

  • Save siwells/1443197 to your computer and use it in GitHub Desktop.

Select an option

Save siwells/1443197 to your computer and use it in GitHub Desktop.
OMERO: Delete OriginalFiles Script
#!/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