Skip to main content
7-Bedrock
December 19, 2024
Solved

How to Specify an External Drive Path for File Saving in ThingWorx?

  • December 19, 2024
  • 2 replies
  • 655 views

 

I am trying to write a CSV file using the WriteCSVFile function in ThingWorx, but I need to save the file to an external drive. In my code, I have specified the path as E:\CSV_Export_DATA\zzzNaytest.csv, but I am unsure how to set the fileRepository parameter to allow saving the file to this external drive. The function currently does not accept a file path outside of the ThingWorx platform's internal repositories.

Here is the code I’m using:

 

Resources["CSVParserFunctions"].WriteCSVFile({ path: "E:\\CSV_Export_DATA\\zzzNaytest.csv", data: Data, fileRepository: "", withHeader: false });

 

Best answer by Rocko

For security reasons you can't write just anywhere in the filesystem, but only to paths relative to a File Repository.

There is one location for all File Repositories, which is configurable.

 

On your own risk, you could try to create a symlink or hardlink in the filesystem pointing to your "destination" folder and see if that works.

Consider security, availability, robustness and performance effects. They safest version of this would be to have E:\\CSV_Export_DATA point to the TWX file repo, not the other way around.

2 replies

24-Ruby III
December 19, 2024

Similar question - "Specify location for ThingworxStorage and ThingworxBackupStorage folders": https://community.ptc.com/t5/ThingWorx-Developers/specify-location-for-ThingworxStorage-and-ThingworxBackupStorage/td-p/509489 

Rocko
Rocko19-TanzaniteAnswer
19-Tanzanite
December 19, 2024

For security reasons you can't write just anywhere in the filesystem, but only to paths relative to a File Repository.

There is one location for all File Repositories, which is configurable.

 

On your own risk, you could try to create a symlink or hardlink in the filesystem pointing to your "destination" folder and see if that works.

Consider security, availability, robustness and performance effects. They safest version of this would be to have E:\\CSV_Export_DATA point to the TWX file repo, not the other way around.