King0770-Notes-Bulk Upload To Briefcase: Difference between revisions

(New page: Description: This wiki will hopefully answer the question, "How do upload a bunch of files to a user's briefcase?")
 
No edit summary
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Archive}}{{Unsupported}}
Description: This wiki will hopefully answer the question, "How do upload a bunch of files to a user's briefcase?"
Description: This wiki will hopefully answer the question, "How do upload a bunch of files to a user's briefcase?"
===From a remote machine===
If you wish to upload files from a remote server to the Zimbra server, you could use curl to upload.<br>
Here's an example of uploading a single file:<br>
<code><pre>
curl -u zimbra_user:zimbra_user_password --data-binary "@/mp3/Let it be.mp3" http://zimbra.domain.com/service/home/zimbra_user/Briefcase/Let_it_be.mp3
</pre></code>
You can use DAV too :
<code><pre>
curl -u zimbra_user:zimbra_user_password -T "/mp3/Let it be.mp3" http://zimbra.domain.com/dav/zimbra_user/Briefcase/
</pre></code>
You'll note I've put double quotes around "@/mp3/Let it be.mp3", because the file name contains spaces. I tried putting double quotes around the Zimbra address with a file that had spaces, but it didn't seem to work for me. The only way to upload was successful, was to put underscores in the filename. Perhaps curl doesn't like file names with spaces.<br>
You should be able to run a for loop to upload files to a user's briefcase:<br>
I had found the following worked for me.
<code><pre>
for i in `ll | awk '{ print $9 }'`; do curl -u zimbra_user:zimbra_user_password --data-binary "@/docs/$i" http://zimbra.domain.com/service/home/zimbra_user/Briefcase/$i; done
</pre></code>
If you had already worked out the "files with spaces" issues, this command should be sufficient.
<br>
===From the Zimbra machine===
If there a bunch of files you wish to upload to a user's briefcase from the Zimbra machine, the following command examples should help.<br>
Single File
<code><pre>
zmmailbox -z -m user1@domain.com postRestURL --contentType application/msword "/Briefcase/Letter.doc" "/tmp/documents/Letter.doc"
</pre></code>
Multiple Files
<code><pre>
for i in `ll | awk '{ print $9 }'`; do zmmailbox -z -m user1@domain.com postRestURL --contentType application/msword /Briefcase/"$i" /tmp/documents/"$i"; done
</pre></code>
If you wish to distinguish the different file types, you might want to run the for loop on all files with the sames extension. This way you don't have to keep switching the "--contentType" setting.
[[Category: Zimbra Web Client]]

Latest revision as of 13:03, 24 March 2015


Description: This wiki will hopefully answer the question, "How do upload a bunch of files to a user's briefcase?"

From a remote machine

If you wish to upload files from a remote server to the Zimbra server, you could use curl to upload.

Here's an example of uploading a single file:

curl -u zimbra_user:zimbra_user_password --data-binary "@/mp3/Let it be.mp3" http://zimbra.domain.com/service/home/zimbra_user/Briefcase/Let_it_be.mp3

You can use DAV too :

curl -u zimbra_user:zimbra_user_password -T "/mp3/Let it be.mp3" http://zimbra.domain.com/dav/zimbra_user/Briefcase/


You'll note I've put double quotes around "@/mp3/Let it be.mp3", because the file name contains spaces. I tried putting double quotes around the Zimbra address with a file that had spaces, but it didn't seem to work for me. The only way to upload was successful, was to put underscores in the filename. Perhaps curl doesn't like file names with spaces.

You should be able to run a for loop to upload files to a user's briefcase:
I had found the following worked for me.

for i in `ll | awk '{ print $9 }'`; do curl -u zimbra_user:zimbra_user_password --data-binary "@/docs/$i" http://zimbra.domain.com/service/home/zimbra_user/Briefcase/$i; done

If you had already worked out the "files with spaces" issues, this command should be sufficient.

From the Zimbra machine

If there a bunch of files you wish to upload to a user's briefcase from the Zimbra machine, the following command examples should help.

Single File

zmmailbox -z -m user1@domain.com postRestURL --contentType application/msword "/Briefcase/Letter.doc" "/tmp/documents/Letter.doc"

Multiple Files

for i in `ll | awk '{ print $9 }'`; do zmmailbox -z -m user1@domain.com postRestURL --contentType application/msword /Briefcase/"$i" /tmp/documents/"$i"; done

If you wish to distinguish the different file types, you might want to run the for loop on all files with the sames extension. This way you don't have to keep switching the "--contentType" setting.

Jump to: navigation, search