Thanks so much for your reply Andrea,

 

You were spot on.  I have to run the update from the tomcat home directory – and then it works as advertised.

 

If anyone is interested I’ve written a couple of scriptlets I run from ~tomcat.  First I export the item I want to add to:

 

#!/bin/bash

# 10092 is the prefix for our handles

 

 

echo enter a handle 10092/

read HANDLE

 

/ir/dspace/bin/dspace dsrun  org.dspace.app.itemexport.ItemExport -t ITEM -i 10092/$HANDLE -d /usr/local/tomcat/export -n $HANDLE

 

 

Then I copy the new file I want to add to the directory I just made and run ls FILENAME > contents to overwrite the contents file

 

Then I import it into Dspace

 

 

#!/bin/bash

# Dspace item updater.  anton.angelo@canterbury.ac.nz 7 Nov 2014

 

#Usage

# Run from /usr/local/tomcat

# will update everthing Dspace Simple Archive format

# under the ./export directory

 

 

/ir/dspace/bin/dspace itemupdate  --eperson=appropriate@eperson -A --source=/usr/local/tomcat/export/

 

echo "Now delete the undo directories (if it worked!)"

 

 

I’ve been able to load MUCH larger files than through the web interface this way (I’ve had 4/5Gb datasets recently, darned physicists!)

 

Thank you for your help,

 

 

Anton Angelo

Research Data Co-ordinator

University of Canterbury, Christchurch, New Zealand.

 

James Hight Building, 519, Level 5

Ph +64 3 364 2987 extn 8718

 

 

 

 

From: Andrea Schweer [mailto:schweer@waikato.ac.nz]
Sent: Friday, 1 November 2013 11:41 a.m.
To: Anton Angelo; dspace-tech
Subject: Re: [Dspace-tech] using itemupdate from the command line

 

Hi Anton,

On 01/11/13 08:51, Anton Angelo wrote:

I create an archive using the itemexport function, edit the contents file (with echo filename >> contents), add the file to the archive  and then run

 

 

/ir/dspace/bin/dspace dsrun  org.dspace.app.itemupdate.ItemUpdate -A --eperson=valid@eperson --source=/usr/local/tomcat/1/testdata –verbose

 

In return I’m getting:

 

Add bitstreams

Actions to be performed:

    org.dspace.app.itemupdate.AddBitstreamsAction

ItemUpdate - initializing run on Thu Oct 31 14:36:26 NZDT 2013

 

Done processing.  Successful items: 0 of 0 items in source archive

 

End.

 

Any ideas why it isn’t adding the bitstream either to the archive or to the item in the repository?

 


I just used this sequence to add a file to an existing item using export/import (DSpace 1.8.2):
[dspace]/bin/dspace export -i [prefix]/3998 -t ITEM -d /data/tmp -n 0
echo handles-with-fulltext.xml  > /data/tmp/0/contents
cd /data/tmp && [dspace]/bin/dspace itemupdate -A --source . --verbose -e user@example.com

There is something odd going on with interpolating the "source" argument it seems.  /data/tmp is the parent of the "0" directory created by the export. Note I had to cd to that directory and use "." as the source. Using /data/tmp or /data/tmp/ as the source argument, I get "ERROR creating  Undo Archive directory".

Finally, I had to use ">", ie overwrite the contents file; otherwise it complained about existing bitstreams (including the license bitstream, which you're likely to have even when you think the item has no files).

cheers,
Andrea


-- 
Dr Andrea Schweer
IRR Technical Specialist, ITS Information Systems
The University of Waikato, Hamilton, New Zealand