Skip to main content
16-Pearl
March 6, 2022
Solved

How to get path of the file in Thingworx custom File repository(Thingworx Cloud 9.1)

  • March 6, 2022
  • 1 reply
  • 2602 views

Hi ,

I am looking to access a file from File repository in twx , using below script.

i need Source Directory , source file name to be mentioned from Twx custom file repository  to run this code.

 

VaibhavShinde_0-1646552511358.png

Thanks,

Best answer by Mukul_467346

And your specific file can be stored anywhere in File Repository, it does not need to be in the root, correct? If that's correct then I believe you have to first get all the directories and then loop through to get all the file links. Once you have that, you can pick your file name from it and the associated link. This has already been discussed here:

https://community.ptc.com/t5/ThingWorx-Developers/List-all-files-in-a-File-Repository-TXW-9-1/td-p/716846

 

Let me know if my understanding is not correct, if that's the case I would request you to elaborate more. 


Thanks,

Mukul Narang

1 reply

1-Visitor
March 7, 2022

you can browse a ThingWorx repository using "BrowseDirectory" or "BrowseFileSystem" service in your repository. Using these services you can get all the directories and files (with name and path) available in your repository. 

16-Pearl
March 7, 2022

Hi @Mukul_467346 

I need to see the path of the specific file which is stored in File Repository, if we try to execute "BrowseDirectory" or "BrowseFileSystem" services

service itself need PATH as input. 

 

Thanks,

 

1-Visitor
March 8, 2022

And your specific file can be stored anywhere in File Repository, it does not need to be in the root, correct? If that's correct then I believe you have to first get all the directories and then loop through to get all the file links. Once you have that, you can pick your file name from it and the associated link. This has already been discussed here:

https://community.ptc.com/t5/ThingWorx-Developers/List-all-files-in-a-File-Repository-TXW-9-1/td-p/716846

 

Let me know if my understanding is not correct, if that's the case I would request you to elaborate more. 


Thanks,

Mukul Narang