Gmansolf / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Recursively upload directory structure to Docs #69

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please add the ability to recursively upload a directory structure containing 
all kinds of file types to Docs. If a directory structure could be synchronized 
with an existing folder on Docs, this would be a great plus!

Motivation:

I would like to use Docs as a backup media.

What version of the product are you using? On what operating system?

0.9.5 on Ubuntu 10.04

Original issue reported on code.google.com by sj1...@gmail.com on 19 Jun 2010 at 8:20

GoogleCodeExporter commented 8 years ago
This may depend on Issue 63

Original comment by sj1...@gmail.com on 19 Jun 2010 at 8:21

GoogleCodeExporter commented 8 years ago
No it doesn't. Gdata API supports folder creation and uploading documents to 
folders.

Original comment by bart...@gmail.com on 21 Jun 2010 at 7:58

GoogleCodeExporter commented 8 years ago
I second that motion!

Original comment by luciusapulius@gmail.com on 24 Jun 2010 at 2:30

GoogleCodeExporter commented 8 years ago
coupling Cron for automation and the ability to backup any file to google docs 
would make Google's GB's per year plan a great way to do an offsite backup! I 
would love this!

Original comment by ianjames...@gmail.com on 25 Jun 2010 at 3:02

GoogleCodeExporter commented 8 years ago
I dealt with this issue a bit more and built a little application to 
synchronize a folder with Docs (http://code.google.com/p/syncdocs/). In the 
course of this I found out that the API is still limited to merely 
document-type files. So far only Google Apps Premier domains are able to upload 
any file type. See 
http://googlecode.blogspot.com/2010/01/documents-list-api-upload-any-file-type.h
tml.

Original comment by sj1...@gmail.com on 28 Jun 2010 at 6:12

GoogleCodeExporter commented 8 years ago
Also see this issue http://code.google.com/p/gdata-issues/issues/detail?id=2073 
in the gdata-issues project and vote for it :-)

Original comment by sj1...@gmail.com on 28 Jun 2010 at 6:20

GoogleCodeExporter commented 8 years ago
I played with this a bit and added test implementation of uploading directories 
to googlecl. If user provides directory as a parameter to googlecl it will 
upload it recursively, including all documents and subdirectories. 

It works for me just fine even with binary files like executables without 
extention. It didn't work with .mp3 files even if I renamed them to the file 
without extention.
It also refused to accept files bigger than 500Kb, so I doubt that this service 
can be used for backups of anything exept of documents. 

Here is the example:
This is the content of the test directory:
./test/
./test/test.xls
./test/test.txt
./test/diffimg
./test/empty
./test/subdir1
./test/subdir1/test_subdir1.txt
./test/subdir1/test_subdir1.xls
./test/subdir1/subdir2
./test/subdir1/subdir2/test_subdir1_subdir2.xls
./test/subdir1/subdir2/test_subdir1_subdir2.txt
./test/empty_subdir1
./test/empty_subdir1/empty_subdir2

diffimg is a linux executable in ELF format.

Here is the command I used and the output:
$ google docs upload --user bartosh@gmail.com ./test
Created folder ./test test
Uploading test.xls to the test folder
Loading ./test/test.xls
Upload success! Direct link: 
http://spreadsheets.google.com/ccc?key=0Ah3O4vHEPDdQdFlxbGtUeUdoY1ZtMFUxa0U4eHRR
emc&hl=en
Uploading test.txt to the test folder
Loading ./test/test.txt
Upload success! Direct link: 
http://docs.google.com/Doc?docid=0AR3O4vHEPDdQZGR6Y3MzeHpfNDZjY2htaHRocg&hl=en
Uploading diffimg to the test folder
No extension on filename! Treating as txt
Loading ./test/diffimg
Upload success! Direct link: 
http://docs.google.com/Doc?docid=0AR3O4vHEPDdQZGR6Y3MzeHpfNDdmbmc0anZmNg&hl=en
Created folder ./test/empty empty
Created folder ./test/subdir1 subdir1
Uploading test_subdir1.txt to the subdir1 folder
Loading ./test/subdir1/test_subdir1.txt
Upload success! Direct link: 
http://docs.google.com/Doc?docid=0AR3O4vHEPDdQZGR6Y3MzeHpfNDhjdDZyOWdoaA&hl=en
Uploading test_subdir1.xls to the subdir1 folder
Loading ./test/subdir1/test_subdir1.xls
Upload success! Direct link: 
http://spreadsheets.google.com/ccc?key=0Ah3O4vHEPDdQdEU0NS1QY3FfTndFc2FNdXdiT013
NFE&hl=en
Created folder ./test/subdir1/subdir2 subdir2
Uploading test_subdir1_subdir2.xls to the subdir2 folder
Loading ./test/subdir1/subdir2/test_subdir1_subdir2.xls
Upload success! Direct link: 
http://spreadsheets.google.com/ccc?key=0Ah3O4vHEPDdQdFVNcE83N3dxQUd3d01zWUtiXzJI
RWc&hl=en
Uploading test_subdir1_subdir2.txt to the subdir2 folder
Loading ./test/subdir1/subdir2/test_subdir1_subdir2.txt
Upload success! Direct link: 
http://docs.google.com/Doc?docid=0AR3O4vHEPDdQZGR6Y3MzeHpfNDlnNHNmdnJnaA&hl=en
Created folder ./test/empty_subdir1 empty_subdir1
Created folder ./test/empty_subdir1/empty_subdir2 empty_subdir2

Here is the patch:

Original comment by bart...@gmail.com on 28 Jun 2010 at 7:19

Attachments:

GoogleCodeExporter commented 8 years ago
Nifty. I've started incorporating and testing the patch, should be done 
tomorrow AM (EDT)

Original comment by tom.h.mi...@gmail.com on 29 Jun 2010 at 3:50

GoogleCodeExporter commented 8 years ago
Alright, seems to be working well! r309 fixes (enhances?) this issue.

Original comment by tom.h.mi...@gmail.com on 29 Jun 2010 at 2:00

GoogleCodeExporter commented 8 years ago
Always forget to actually change the status...

Original comment by tom.h.mi...@gmail.com on 29 Jun 2010 at 2:00