Best way to download images from a specified folder

We stored tens of thousands of images in the TD repository. We want to download those images to reuse them for other purpose. The images are stored in hierarchical folders organized according to the illustration management number. There are hundreds of images in one folder.

I think that the most primitive method to download hundreds of images is using search function. But this method is too painful and it takes so much time.

I'm searching a way to achieve above mentioned task efficiently by using ISHRemote or web API.

I appreciate any suggestions.

Kind regards,

Naoki

  • Hi Naoki,

    This is indeed a scenario where ISHRemote could work. In between meetings I came up with the following code construct, it highlights the cmdlets you need and hopefully sets you off in the right direction to comply with your custom setups and rules.

    The below cmdlet takes a full folder path, gets the content filtered to only "Low" resolution images and drops them in the C:\Temp\20200708  folder of the system running ISHRemote.

    Get-IshFolder -FolderPath "\General\Planning\Scalability\Images" |
    Get-IshFolderContent -MetadataFilter (Set-IshMetadataFilterField -Level Lng -Name FRESOLUTION -FilterOperator Equal -Value "Low") |
    Get-IshDocumentObjData -FolderPath C:\temp\20200708

    The result in C:\temp\20200708 looks like

    basic infoshare installation (vpn)=GUID-A4476B47-350E-4C19-9E8F-F02504568741=1=en-us=Low.jpg
    basic infoshare installation with one firewall=GUID-73457A06-E9DB-4574-BB20-79C3358513A7=1=en-us=Low.jpg
    basic infoshare installation with two firewalls=GUID-A48C942E-FD85-4776-A104-8AD6AF439772=1=en-us=Low.jpg
    basic infoshare installation=GUID-A5B24B14-F0C1-4C18-B33B-6B1C8ED8A6C1=4=en-us=Low.png
    batch server configuration=GUID-2AD51EE7-F90A-409A-9570-65542A99CA67=3=en-us=Low.png
    component load balancing=GUID-D5C3D15F-785E-471F-A051-96B943FBCE48=3=en-us=Low.png

    Best wishes,
    Dave

  • Hi Dave,

    Thank you for teaching the cmdlet for downloading images from a folder. I confirmed that the following cmdlet works properly.

    Get-IshFolder -FolderPath "\General\3A Images LCA\2\2A\2AK\2AKDA include-text" | Get-IshFolderContent | Get-IshDocumentObjData -FolderPath "C:\tmp\image"

    However, if I specified the -MetadataFilter option for Get-IshFolderContent cmdlet as shown below code, the error occurs.

    Get-IshFolder -FolderPath "\General\3A Images LCA\2\2A\2AK\2AKDA include-text" | Get-IshFolderContent -MetadataFilter (Set-IshMetadataFilterField -Level Lng -Name FRESOLUTION -FilterOperator Equal -Value "High") | Get-IshDocumentObjData -FolderPath "C:\tmp\image"

    Get-IshFolderContent : パラメーター名 'MetadataFilter' に一致するパラメーターが見つかりません。

    In English,

    Get-IshFolderContent : Cannot find a matching parameter which name is 'MetadataFilter'.

    I'm using ISHRemote Version 0.11.0.

    Am I wrong something?

    Kind regards,

    Naoki

  • Hi Dave,

    Since we assigned special prefixes to image objects, I realized that I can use Find-IshDocumentObj instead of Get-IshFolderContent. I thought out following code and it satisfied our needs.

    # image_download.ps1 <PUBID> <download_folder_path>
    Param($pubid, $download_folder_path)
    $resolution = "Edited"
    New-IshSession -WsBaseUrl https://XXXXXXXXXX/ISHWS/ -IshUserName XXXXX -IshPassword XXXXX
    Find-IshDocumentObj -IshTypeFilter ISHIllustration -MetadataFilter (Set-IshMetadataFilterField -Level Logical -Name FTITLE -FilterOperator Like -Value $pubid),(Set-IshMetadataFilterField -Level Lng -Name FRESOLUTION -FilterOperator Equal -Value $resolution) | Get-IshDocumentObjData -FolderPath $download_folder_path

    Again, thank you for your suggestion, Dave.

    Best regards,

    Naoki

  • Hi Naoki,

    That is a bit my mistake, I'm working on v0.12 of ISHRemote and one of the 7 improvements already implemented is -MetadataFilter on cmdlet Get-ishFolderContent. On more what is coming check the closed (and open) issues on https://github.com/sdl/ISHRemote/milestone/9?closed=1

    -Dave

  • Yep the Find-IshDocumentObj works if you can filter enough. There is a risk of course that if you don't filter enough that you are pulling millions of objects to your ISHRemote client and in turn trying to load them in memory (or probably out-of-memory)

    This is one of the reasons that I started implementing the https://github.com/sdl/ISHRemote/milestone/9?closed=1 changes like above -MetadataFilter on cmdlet Get-ishFolderContent as iterating folder is by itself a nice way to break the data problem in smaller chunks (read folders :-) )

    -Dave