Export all files tagged with a specific tag

Hi all,

After having successfully installed OC V.10.10.0 (stable) I want to migrate all documents from my OpenKM installation.

Before I do this, I need to know how to export by mass all documents tagged with a certain tag-id.
Unfortunately, in the web-UI, tags can be filtered but then, the export functionality is not there.
So I went through more technical stuff, the request being rare, occasionally once a year for audit.

Current situation:

I figured out how to access to the MySQL table = oc_systemtag_object_mapping .
Also, I have full access to the file path / name in table = oc_filecache

The only thing which is missing is a statement to export the files from the directory. Is there any functionality to do so? I’ll be thankfully for all advices.


Whenever you have the path, you could use curl to get the file. Or did I miss something?
Personally, I’d prefer using the APIs, in favor of direct SQL access.


I went through the CURL documentation.
Unfortunately, I didn’t managed to download an integer file…

curl -X GET -u user:pwd “https://docs.XXX.com/owncloud/remote.php/webdav/” -o Scan08-14-2022-094509.pdf

The document is in my home directory with exactly the filename but it is “empty”. 0KB.

Hmm. Any idea?

Adjust your syntax:

curl -u user:pwd -o Scan08-14-2022-094509.pdf https://docs.XXX.com/owncloud/remote.php/dav/files/user/Scan08-14-2022-094509.pdf

Replace user in the URL accordingly.

Exactly the same behaviour.
The file appears, but when I open it, it’s “broken”.

That’s what happens in console:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6587 0 6587 0 0 29237 0 --:–:-- --:–:-- --:–:-- 30495

What do you mean with broken? Is your cloud encrypted?

You can disable the progress indicator with the -s or --silent option.

Cloud is not encrypted.

File doesn’t open in Finder. It says it’s broken.
I don’t get it.

Well, maybe it is really broken. May I assume you already tried with another file?

I tried also with the default owncloud documentation file.

this is the exact error message of Adobe Reader:

Adobe Acrobat Reader konnte „Scan08-14-2022-094509.pdf“ nicht öffnen, da der Dateityp nicht unterstützt wird oder die Datei beschädigt ist (z. B. wenn sie als E-Mail-Anhang geschickt und nicht korrekt dekodiert wurde).

You can try to add this

-H "charset=utf-8" 

to your curl command.

Same result :frowning:
Running out of ideas…

I’d create a diff to the original file still residing on the server.

Another try could be, using

-H "application/pdf;charset=utf-8" 

at least for PDF files.

1 Like

Also not…
< X-Permitted-Cross-Domain-Policies: none

I don’t get the issue though.

Good news!
Today in the morning time it works.
Don’t ask why… I don’t get it.
Here the final statement, quite exactly like above, but now the files are readable. Tested with pdf and txt as well. Bizarre!

curl -k -u gabriel:pwd -o "Owncloud Manual.pdf" -v -H "application/pdf;charset=utf-8" "https://XXX/remote.php/dav/files/XXX/Privat - Gabriel/Sonstiges/ownCloud Manual.pdf"

Anyway, your hint from above was the rigth direction on the path to the solution. So thanks for this and thx for sustaining me constantly!

1 Like

Final remarks: You didn’t use this in the initial curl command. Is something wrong with your certificate? And BTW, you should always hide all sensitive information in your posts.

1 Like

I can connect http or https
If I take https I don’t check the certificate.
Result is the same.

Where did I put confidential credentials ?

This is simply base64 encoded, straightforward to decode.

1 Like

Ok no problem
Haven’t seen it
It’s now deleted.