File_List Command
File_List Command
Initially we were using a variable along the lines of ${This_File}, which displayed the full file path (something we do not want) until we started adding the :name attribute.
- Code: Select all
We have moved ${This_file[1]:name}
However, this method felt clumsy because it required a duplicate variable entry for every file that would be reported as it would only list the files directly referenced.
- Code: Select all
We have moved ${This_file[1]:name} ${This_file[2]:name} ${This_file[3]:name}
So I started trying to use File_List to do this instead, which worked perfectly for the basic process and simplified things a bit, but again displayed the full file path. So I attempted adding the :name attribute here as well, but File_List seems to act the same as This_File when :name is added, and it displays the first file within the list when you do ${File_List[1]:name}
Am I missing something simple here to give one or both of these commands a wild card? Or is there some better method of using File_List so that it will list all of the files within the list without their path?
- MDeVore
- Posts: 3
- Joined: Tue Aug 07, 2012 2:22 pm
Re: File_List Command
If you're wanting to see a "list" of files moved in the email without the file path, then you will have to create a Variable and loop through the FileList appending the name of the file ${File:name} to the variable, then printing the list at the end.
- Code: Select all
These files have been Moved by GoAnywhere
File1.txt
File2.csv
File3.xml
This could be done with the following code:
- Code: Select all
<createFileList label="Get FileList" fileListVariable="Files" numFilesFoundVariable="NoFiles" version="1.0">
<fileset dir="${ MyDIR }" recursive="true">
<dateFilter>
<include to="${ CutOffDate }" />
</dateFilter>
</fileset>
</createFileList>
<setVariable label="Init FileList" name="FileList" value="${ system.emptyString }" version="1.0" />
<forEachLoop label="List Files" itemsVariable="${Files}" currentItemVariable="ThisFile">
<setVariable label="Update FileList" name="FileList" value="${ FileList }${ system.carriageReturn }${ ThisFile:name }" version="1.0" />
<move label="Move Doc" sourceFile="${ ThisFile }" destDir="${ NewDIR }" whenFileExists="overwrite" version="1.0" />
</forEachLoop>
<sendEmail label="Send Notification" resourceId="MyResource" toList="ToEmail@MyDomain.com" version="2.0">
<from address="GA_Admin@MyCompany.com" />
<subject>
<![CDATA[ These files have been Moved by GoAnywhere ]]>
</subject>
<message>
<![CDATA[ ${ FileList } ]]>
</message>
</sendEmail>
*NOTE* ${ MyDir } is a Variable set to the Directory you want to get the File List from. ${ CutOffDate } is used in this example for identifying a specific group of Files within ${ MyDir }
If there are any questions, please feel free to let us know.
-Rick
Sr. Product Specialist
(402) 944.4242 x754
- Support_Rick
- Support Specialist
- Posts: 36
- Joined: Tue Jul 17, 2012 1:12 pm
Re: File_List Command
- Code: Select all
<createFileList fileListVariable="fileList" numFilesFoundVariable="listCount" version="1.0">
<fileset dir="myDIR" />
</createFileList>
<setVariable name="sourceList" value="${system.emptyString}" version="2.0" />
<forEachLoop itemsVariable="${fileList}" currentItemVariable="thisFile">
<setVariable name="sourceList" value="${sourceList}${system.carriageReturn}${ThisFile:name} " version="2.0" />
</forEachLoop>
- MDeVore
- Posts: 3
- Joined: Tue Aug 07, 2012 2:22 pm
Who is online
Users browsing this forum: No registered users and 0 guests