Briefcase command line to pull from collect

Hello everyone,

I hope you are all good and safe.

I need some help with pulling the ODK finalised forms from ODK collect to my laptop. I have written a short script to do this automatically using the ODK Briefcase command lines. I have attached this script for your reference.

1. What is the problem? Be very detailed.
When running the script, the .xml forms get pulled correctly from my Android device to the laptop. These get stored in the following path: "/Users/olimpialamberti/Desktop/ODK_rawfiles_OL/$day/$device/instances" where $day and $device are entered by the user and are 1 and 1 at the moment.

However, when running the "java -jar pull_collect" line, the forms do not get pulled into the new folder. Consequently, this blocks the next line of code for exporting the files.

2. What app or server are you using and on what device and operating system? Include version numbers.
I am using ODK Collect v.1.29. I have ODK-Briefcase-v1.18.0.jar installed. I have also installed the adb command and allowed USB Debugging on my Android Device.

3. What you have you tried to fix the problem?
I have tried re-installing all the programmes and running snippet of code with only one finalised form but no success

I have attached below the code I am using in PDF format - unfortunately the forum doesn't allow me to upload the .sh file
ODK_code.pdf (21.3 KB)

Find below a screenshot of the outcome I get in the terminal.

Any help would be greatly appreciate it :slight_smile:

Thank you in advance and stay safe

My workflow is different.
I am recreating odk on my Windows PC.
For this I create a folder. The name doesn't matter. Let's say I call in odk replica.

In this odk replica I create a folder called forms and a folder called instances.
From the Android phone I copy the Metadata folder as a third folder into my odk replica folder.

The actual form (your XML file) should be stored in the folder named forms (windows) .
In the folder named instances, I copy my instances folder from the Android phone to the folder of the same name under Windows.

Open the ODK briefcase after this.

Go to the tab pull and change in the selection field from Aggregate to collect directory.
Call up the file path of the odk replica folder via choose.
Start the pull process.

After the pull, the push process can be started as usual.

I don't know if this workflow is a solution for your problem.
In my forms this is every time my solution, because I don't use a server because we take many pictures.

Hi @Dominik1,

Thank you for your reply. I usually export data in that way as well. However, this time, this "manual" process will not be very efficient. We will be collecting data over multiple days and multiple device and want a script that pulls and exports the data entries so that there is minimum user need.

Do you know someone who might help me understand what is happening with my code?

Many thanks

Hi @Olimpia,
If automation is your goal, you can use to build a script to download. I can offer some examples if you want to go down that route.

Hi @Florian_May
Thank you for your suggestion. Would you be happy to share some examples? I think that would be very useful. In addition, do you know why my script does not work?

Many thanks,

Upon closer reading of your post I realised that you want to download submissions without uploading them to ODK Central. Is that correct?
So do you want to parse the raw XML submissions into data frames?

Hi @Florian_May

Yes, exactly - I don't want to upload them on ODK Central.

In more details, what I would like to do is connect the android devices by one one to my laptop at the end of a day in the field and run the script that can export all data entry into csv files. The data entries will be exported on the folders corresponding to the day number in the field and device number that are entered at the beginning of the script.

The script should replicate what is normally done manually in ODK briefcase. I took the different bits of code from the command line explanation of ODK Briefcase which I found on the ODK website ( However it is not fully working since it seems that the forms are not pulled into the new folder and I don't understand why.

Let me know if this makes sense and if you have any suggestions