Requests for Automation

Wildcard Transfer

I'm looking for an Agent Procedure that will transfer the entire contents of a known directory back to the KServer without renaming the files. For instance there are 5 .zip files in C:\temp on a remote computer, I don't know the exact name of the files but want to transfer all 5 .zip files back to one directory on the server.

Gravatar for Onno de Vries
Onno de Vries over 4 years ago

Hi Larry, you might find that a recently added script would at least help out to some degree, it's called 'Transfer Files from a Directory to Kserver'. It allows you to fill in a directory, zipps the content of that directory and sends the zip to the Kserver. You can find that file in the Agent Procedure | Get File function, click on the agent used to copy the files from to see the zip file. You can download it from there to you local endpoint and unzip it for further processing.

Gravatar for Jaime
Jaime over 4 years ago

So this one is a little vague but it is possible to do.
First, I'd like to explain that agent procedures are rather static creatures so it would take a bit of recursion (a rather advanced agent procedure) to get an undefined number of zip files to the KServer. The model goes something along the lines of: Call AP-> AP calls Powershell or VBS (maybe BAT?) to enumerate the .zip files the specified directory and outputs a file which contains the full name of one of the zipfiles and another file to track which files have already been processed->AP gets contents of file and uses the "getfile" function to upload to KServer->AP calls itself->AP stops recurring when powershell writes a file to flag stop since powershell knows that all the .zip files have been processed. A much better (easier) option would to compress all of the zip files for a given directory into a .zip file and transfer that to the KServer.
Second, while there are several ways to transfer a file to the kserver I believe the aforementioned getfile function is best for the avg. use case. It will store an uploaded file under a agent's documents which you would find under the agent procedure module

I hope this helps with whomever decided to write this AP. My intent was to define the request into AP terms

Gravatar for Larry Pierce
Larry Pierce over 4 years ago

Thanks Jaime and Onno de Vries for the advise. We ended up going with the zip up everything and transfer back the server route. Then I wrote a batch file that runs on a schedule to unzip the zipped zips and moves them to our processing server.
Would be nice if it was easy as getfiles: c:\temp\*.zip


  • 1 Vote
  • Open for over 4 years
  • Created by Larry Pierce