Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

Accessing the containing folder, as well as the asset


#1

Hi all

I’m trying to find out if it’s feasible to do the following, if you’ve any thoughts on how/if it could be done I’d very much appreciate hearing them.

We have a server with the following folder structure:

-Client Name
—Production Files
------Job123
---------Illustrator
---------Images
---------Thumbnails
---------PDFs
---------Barcodes
------Job124
---------Illustrator
---------Images
---------Thumbnails
---------PDFs
---------Barcodes
------Job125
---------Illustrator
---------Images
---------Thumbnails
---------PDFs
---------Barcodes
------Job126
---------Illustrator
---------Images
---------Thumbnails
---------PDFs
---------Barcodes

I have Portfolio setup to catalogue only the contents (a single jpg) of the ‘Thumbnails’ folder. Obviously this only allows me to download the actual files within this folder.

What I want to do is view a catalogue of the jpgs in the Thumbnail folder, but when it comes to downloading I’d like to take the complete folder structure from jobxxx along with the 5 sub folders. Ideally as a zip file.

Is this something that the API will give me the tools to accomplish, or would I be better creating something totally custom on the front end using the SQL database on the backend.

Really appreciate any advice you’re able to offer.

S


#2

Hi Steven,

Interesting puzzle. The API does not allow you to access the folder structure directly. There are some interactions with Autosync folders, but that wouldn’t help you for files that do not reside in those folders, and I there isn’t any Jobs or Tasks that would all you to zip up and download a folder, as they are aimed at the assets themselves.

What you can do, is get the location of the job using the Directory Path. The Directory Path contains the folder location of the file. So, using your example, if you were looking at the Thumbnail for /Client Name/Production Files/Job123/Thumbnails/thumbnail123.jpg, the Directory Path would be “/Client Name/Production Files/Job123/Thumbnails/

So I would do something like this.
[ul]
[li]Get the Directory Path.

$attributes = $asset->attributes; foreach ($attributes as $field) { if ($field->name == "Directory Path") { $path = $field->values; break; } } echo $path;[/li]
[li]Trim ‘/Thumbnails/’ off the end of the path. This gets me ‘/Client Name/Production Files/Job123’[/li]
[li]Zip the folder and contents.[/li]
[li]Download zipped file.[/li][/ul]

Obviously this is a very high end description of how to accomplish this, but a lot of the heavy lifting of this sort of project falls outside the scope of the API, but it should be doable.