Skip to content
many-decom-targz-files-xnat-importer 801 B
Newer Older
#!/bin/sh

USER=admin
PASSWORD=admin
HOST=http://192.168.56.103:8080
PROJECT=proj1608-i
DIRECTORY=../brain_database/12212.df/*.tar.gz

echo "the size of your data is" 
du -s $DIRECTORY

echo "continue (1/2)?"
select yn in "Yes" "No"; do
    case $yn in
        Yes ) break;;
        No ) exit;;
    esac
done

for FILE in $DIRECTORY
do 
	result=`curl -X POST -u $USER:$PASSWORD "$HOST/data/services/import?format=json" -F project=$PROJECT -F prearchive_code=1 -F auto-archive=true -F quarantine=false -F "image_archive=@$FILE" | grep "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10"`
	if [ -z "$result" ]; then
		echo "Successfully uploaded!"
	else
		echo "ERROR: Session already exists with matching files.Your data may be available in the prearchive for your review."
fi 
done