IQSS / dataverse-client-r

R Client for Dataverse Repositories
https://iqss.github.io/dataverse-client-r
61 stars 25 forks source link

Upload and download a zip file, maintaining folder structure #18

Closed pdurbin closed 5 years ago

pdurbin commented 7 years ago

@leeper do you remember a feature we had in DVN 3 where you could upload a zip file and the folder structure would be recorded in the database and then people could come along later and download the files as a zip and on the fly DVN would create a zip file with the same folder structure as when the files were uploaded?

leeper commented 7 years ago

Yes, at least the upload part - if you put everything in folders, they would end up in a hierarchy in dataverse that was visible in the UI. I don't recall if it was possible to download them all as a single zip in that structure, though.

pdurbin commented 7 years ago

I just tested it on DVN 3.6 and it works a little differently that I remembered.

My expectation is that you'd get the same zip file back but it seems like it changed the folder structure somewhat.

I uploaded data.zip

I downloaded study_10000.zip

My directory folder1/sub1 got changed to folder1-sub1, which is pretty weird. Also, because I used the same filename (file.txt) in the data I uploaded, some of the files got renamed to file_2.txt and file_3.txt, for example.

The zip file I uploaded

murphy:zip pdurbin$ zip -r data.zip folder1 folder2 -x "*.DS_Store"
  adding: folder1/ (stored 0%)
  adding: folder1/sub1/ (stored 0%)
  adding: folder1/sub1/file.txt (stored 0%)
  adding: folder1/sub2/ (stored 0%)
  adding: folder1/sub2/file.txt (stored 0%)
  adding: folder2/ (stored 0%)
  adding: folder2/sub1/ (stored 0%)
  adding: folder2/sub1/file.txt (stored 0%)
  adding: folder2/sub2/ (stored 0%)
  adding: folder2/sub2/file.txt (stored 0%)
murphy:zip pdurbin$ 

The zip file I downloaded

murphy:unzip pdurbin$ unzip study_10000.zip 
Archive:  study_10000.zip
  inflating: folder1-sub1/file.txt   
  inflating: folder1-sub2/file_1.txt  
  inflating: folder2-sub1/file_2.txt  
  inflating: folder2-sub2/file_3.txt  
  inflating: MANIFEST.TXT            
murphy:unzip pdurbin$ 

Here's how it looks in the DVN 3 GUI, by the way:

screen shot 2017-09-05 at 1 38 44 pm

pdurbin commented 5 years ago

This feature of being able to upload zip with a directory hierarchy and then download it again, preserving the hierarchy, is build in to Dataverse 4.12 so I'm closing this issue. For details and screenshots, please see https://groups.google.com/d/msg/dataverse-community/8gn5pq0cVc0/MCMQAQHRAQAJ