file properties

If you have a new question you’d like our support staff to post a response to, please visit our customer community, GoAnywhere Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at https://insiders.goanywhere.com.

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
5 posts Page 1 of 1

ehersh

Posts: 56
Joined: Mon Sep 26, 2016 12:50 pm

Post by ehersh » Wed Oct 26, 2016 8:01 am
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

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Wed Oct 26, 2016 8:06 am
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

Posts: 56
Joined: Mon Sep 26, 2016 12:50 pm

Post by ehersh » Wed Oct 26, 2016 8:28 am
It does look like I would have to set up a rowset first correct?

Support_Rick

Support Specialist
Posts: 592
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Wed Oct 26, 2016 8:32 am
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

Posts: 56
Joined: Mon Sep 26, 2016 12:50 pm

Post by ehersh » Mon Jan 30, 2017 3:45 pm
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>
5 posts Page 1 of 1