OL Learn

Variable images in subfolders

Hello,

is there any way to search subdirectories in Connect Designer for variable images?
As far as I know, there is currently no such possibility and unfortunately I have not yet found a way to solve this via a script.
Or does anyone know a good approach?

Otherwise it would be nice if a corresponding filesystem method could be added (scan directories). Maybe like fs module in nodejs (fs.readdirSync()), so we could iterate over subdirectories to find specific file(s).

Hi @thomasweber,

Do you know the absolute path of these subdirectories beforehand? Because an option to check if a file does exist is by making use of the following JavaScript code:

if (resource("C:/in/example.pdf")) {
    // File does exist...
} else {
    // File does NOT exist...
}

Source: ‘resource() - PrintShop Mail Connect 2021.2 User Guide’

Hi @Marten,

thank you for your suggestion. I don’t need the possibility to check if a file exists. I need the ability to find files in subdirectories, where I don’t know the names of the subdirectories.

Example:
I have the information in which main directory my variable images are located. But the images are stored in subdirectories. In the database I only have the image name, but not the information in which subfolder the image is located. Also, there is no data field that tells me the name of the subfolder.

You could, in Workflow, use the Folder Listing plugin and then search for the position of your file in it.
Then you could update your data with that proper path.

Or use workflow to capture files of the right type, including subdirectories, and deposit them to a known location.

Thanks for these suggestions, but I need a way to do it in the Designer (without Workflow). Thats why I tagged this topic as a feature request. I think it would be a great advantage/improvement to have a filesystem method in the Designer to do things like that.