Kaseya Community

how to grab wildcards from a directory and copy to a unc?

This question is not answered

I have a script I am working on that I need some assistance.


I need to kick off an exe, wait for it to create the output (which is a serialized, semi-random named xml file) and then copy that output file via script procedure to a UNC path relative to the Kserver (which may or may not be visible to the agent actually running the script).


which command should I use?  should I use "get file" and feed it "[pathtomyfile]\*.xml"? what filename do I use to place it on the UNC path (leave the filename blank?) If this was a simple "get specific filename and copy" its a no brainer, but Im not sure how to handle copying a wildcard.



All Replies
  • If that is the only XML file in there, you could execute a shell command to a variable... "dir /B [yourPath]*.xml" (then use that variable wherever you want in the script)

  • If the output file is created in the same directory every time then another way to approach this might to watch that directory for changes then, when a change is detected, start a vbscript that reads the file name from the directory and does the file copy for you. Once the copy is complete the script would delete the original file and you'd wait for the next change. And there's probably a way to do the same from a Kaseya script but I'm usually more comfortable working with vbscripts so I tend to lean that way...

  • Its gotta be Kaseya ZIppo. The file destination may not be visible to the PC that the script is running on.  If the script runs on a PC thats not on our LAN, the file destination will be behind the firewall, so I have to use Kaseya to pull it from the agent and place it on the destination server.

    Smason: it SHOULD be the only one, but its possible there is more than one, which would need to be copied. (the final destination server software would sort out the dupes).