Exporting the metadata of a range of handles in Dspace
October 21, 2014
This is for Andromeda!
(I will come back and edit after I post this to describe stuff a bit more)
”` sh export-dspace-metadata.sh
!/bin/bash
this script can be placed in whatever directory is needed
cd /dspace/bin
this is an interactive part to ask for the first and last handles of the series.
echo “First handle in series :”
read first
echo “Last handle in series :”
read last
a loop to iterate over every handle in the series and export the metadata for each handle to a csv file with the handle as name
for (( i = $first ; i <= $last ; i++ ))
do
./dspace metadata-export -f /dspace/upload/dspacescripts/$i.csv -i 10315/$i
done
this gets the desired name of the final .csv file produced by the export
echo “Name of new file :”
read filename
this is the directory we use to host our dspace scripts.
cd /dspace/upload/dspacescripts
this concantenates all of the csv files produced above (there is one per handle) into a single csv file with your chosen name
for (( i = $first ; i <= $last ; i++ ))
do
awk ‘NR!=1’ $i.csv » $filename.csv
done
”`