Skip to content

file properties

Post any question you may have in regards to GoAnywhere MFT and let our talented support staff and other users assist you.
If you need a quicker response, please create a support ticket via the customer portal my.goanywhere.com or contact our support team by email at [email protected].
  • ehersh Offline
  • Posts: 56
  • Joined: Mon Sep 26, 2016 12:50 pm

file properties

Post by ehersh »

Is it possible to use a file list and write the contents of that list to an excel spreadsheet? Specifically they want the file name and last date modified in the spreadsheet as 2 columns.
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: file properties

Post by Support_Rick »

Yes,

Just loop through the FileList variable (ForEach). This gives you access to each of the file attributes (Name, Size, LastModifiedDate, etc). Write them out to a temporary CSV file in the Workspace.

When finished looping, read the CSV file into a RowSet, then write the RowSet into the Excel.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • ehersh Offline
  • Posts: 56
  • Joined: Mon Sep 26, 2016 12:50 pm

Re: file properties

Post by ehersh »

It does look like I would have to set up a rowset first correct?
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: file properties

Post by Support_Rick »

Not sure what you mean by "setup a Rowset first" ...

Just "print" the file information into a CSV file in the Workspace. Then, read the CSV when you're done. This creates the RowSet (reading the CSV) that you can write out to your Excel
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
  • ehersh Offline
  • Posts: 56
  • Joined: Mon Sep 26, 2016 12:50 pm

Re: file properties

Post by ehersh »

I was finally able to get back to this project. Thanks Rick it does work. The desired result here is to get a list of files from a directory and e-mail them to the sender to confirm we got the files. I just thought I would share the code. Also if anyone has suggestions to improve efficiency I always try to listen.

Code: Select all

<<project name="Test_email" mainModule="Main" version="2.0" logLevel="verbose">

	<module name="Main">

		<createWorkspace version="1.0" />


		<createFileList label="create e-mail list" fileListVariable="filelist" numFilesFoundVariable="filecnt" version="1.0" disabled="false">
			<fileset dir="<path to>/Eligibility/test2" />
		</createFileList>

		<forEachLoop itemsVariable="${filelist}" currentItemVariable="currentfile" disabled="false">

			<print file="<path to>/test/filelist.csv" append="true" version="1.0" disabled="false">
				<![CDATA[${currentfile:name} ${system.carriageReturn}]]>
			</print>

		</forEachLoop>

		<sendEmail resourceId="mail.wonderboxtech.com" toList="[email protected]" version="2.0" disabled="false">
			<from address="Scion_Dental" />
			<message file="<path to>/Eligibility/test/filelist.csv">
				<![CDATA[The following files were sent today:

]]>
			</message>
			<subject>
				<![CDATA[files sent today ]]>
			</subject>
		</sendEmail>


		<delete file="<path to>/Eligibility/test/filelist.csv" version="1.0" disabled="false" />


		<deleteWorkspace version="1.0" />

	</module>

</project>
Post Reply