Utilize copy service to transfer file WITHOUT overwriting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Utilize copy service to transfer file WITHOUT overwriting
I know this is probably a simple question, but I've been stuck on this for hours. I have a service configured to copy a large file over to all things that fit a certain criteria (software version), but I need some sort of if/else statement to check if the file is already there, and not copy the file again if it already exists. I cannot figure out how to check if the file exists. Help would be greatly appreciated!
Edit: My first approach was to run a browse directory service, return that as an intotable, then make an if then statement checking if the filename I'm looking for was included. But I since found out the .includes does not work in TW. Ideas?
Thank you.
Solved! Go to Solution.
- Labels:
-
Coding
-
Mashup-Widget
-
Troubleshooting
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @AT_10111928.
As Pai stated, you can you use the GetDirectoryStructure and GetFileListing to obtain the list of files. There are also a number of filters available on the platform side you can use for filtering available in Services under Resources > InfoTableFunctions. It's recommended that you review the list available as there are several services that may fit your needs.
Regards.
--Sharon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you are using a ThingWorx Edge Agent, I believe it should come with a GetDirectoryStructure and GetFileListing (or the like) services.
It's been a very long time since I did anything though with our agent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @AT_10111928.
As Pai stated, you can you use the GetDirectoryStructure and GetFileListing to obtain the list of files. There are also a number of filters available on the platform side you can use for filtering available in Services under Resources > InfoTableFunctions. It's recommended that you review the list available as there are several services that may fit your needs.
Regards.
--Sharon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Got it, thank you! The piece I was missing was automating the search. I created a for loop that checks the returned file list for a matching file name. The part I wasn't sure how to do was the for loop; returning the file list was the easy part, it was finding a way to automate the file search that I was struggling with. But I got it taken care of, thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Although performance wise just as fast or close you can use InfoTable Functions Query as well vs. looping.