Pulling FTP File Without Name

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.

Pulling FTP File Without Name

Postby cderendinger » Mon Apr 21, 2014 4:30 pm

I want to be able to pull a file from an FTP server but the naming scheme is random. How do I set FTP to pull any file that is there?
cderendinger
 
Posts: 5
Joined: Tue Jan 14, 2014 10:17 am

Re: Pulling FTP File Without Name

Postby Support_Chris » Wed Apr 23, 2014 8:49 am

Hi cderendinger,
In order to use FTP to pull any and all files that are located in a directory, you'd utilize a fileset on the FTP Get task. You can add a fileset to the FTP Get by clicking on the NEXT button of the FTP Task screen, after you've specified the destination directory.

Here is an example project that does exactly what you're looking for:

Code: Select all
<project name="FTP Get ALL" mainModule="Main" version="2.0">

   <module name="Main">

      <ftp resourceId="My PC" version="1.0">
         <get destinationDir="C:\test\FTP Test\" whenFileExists="overwrite">
            <fileset dir="/upload/" />
         </get>
      </ftp>

   </module>

</project>




In this project, I'm retrieving all files that are located in the /upload/ directory of my FTP server.


Thanks,
Chris
Support_Chris
 
Posts: 6
Joined: Thu Oct 24, 2013 10:23 am

Re: Pulling FTP File Without Name

Postby cderendinger » Thu Apr 24, 2014 7:46 am

In this FTP folder there is 4 files and I am only wanting to retrieve the .xlsx and then delete it. The other 3 files I need to be able keep in the FTP folder.
cderendinger
 
Posts: 5
Joined: Tue Jan 14, 2014 10:17 am

Re: Pulling FTP File Without Name

Postby Support_Chris » Thu Apr 24, 2014 8:34 am

Hi cderendinger,
If you have a specific file you need to grab, you'll drill down to the wildcard filtering portion of the fileset. To do this, click NEXT from the FILESET element and Add a Wildcard Filter, then NEXT and Include Files. In your case, you'll be filtering for *.xlsx. Be sure to define an output variable in the processed source files variable field under the Output Variables tab of the Get Files sub-task.

After the Get Files sub-task, add a Delete Files sub-task to the FTP task and specify the output variable that you created earlier in the Input Files Variable field.

Here is a sample project XML that suits your requirements:

Code: Select all
<project name="FTP Get ALL" mainModule="Main" version="2.0">

   <module name="Main">

      <ftp resourceId="My PC" version="1.0">
         <get label="getFile" destinationDir="C:\test\FTP Test\" whenFileExists="overwrite" processedSourceFilesVariable="getFile">
            <fileset dir="/upload/">
               <wildcardFilter>
                  <include pattern="*.xlsx" />
               </wildcardFilter>
            </fileset>
         </get>
         <delete label="Delete getFile" inputFilesVariable="${getFile}" />
      </ftp>

   </module>

</project>



In this example, we're getting all files that end with the extension .xlsx in directory /upload/ on the FTP server. Then after the Get sub-task, we're deleting the file(s) that were downloaded from the remote FTP server, before disconnecting from the source server.


Thanks,
Chris
Support_Chris
 
Posts: 6
Joined: Thu Oct 24, 2013 10:23 am


Return to Community Forum

Who is online

Users browsing this forum: Support_Rick and 1 guest