Skip to content

carriage return after extension

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

carriage return after extension

Post by ehersh »

We have some customers that have very long file names with embedded spaces such as Customer order - orders_20161129000786_-_20161129_199909X9999_6185773-2 PAGEs todays order_Claim .tiff. I am printiong the names of the files to a .txt file then e-mailing it. I then read the list and send it. The problem is for neatness I would like to send the list in a verticle list format such as:
----------
-----------
-----------
-----------

Not like this ------------------ --------------- ----------------- -------------
However it appears the file names sent to us have embedded spaces so it is not listing them correctly in the .txt file I read from. Each file will have an extension of .TIFF. Is there anyway to insert a carriage return after each .TIFF.

Code: Select all

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

	<module name="Main">

		<createWorkspace version="1.0" />


		<timestamp label="date_time" version="1.0">
			<format outputVariable="Date" pattern="MM/dd/yyyy" />
			<format outputVariable="time" pattern="HH:mm" />
		</timestamp>


		<createFileList label="create e-mail list" fileListVariable="filelist" numFilesFoundVariable="filecnt" version="1.0" disabled="false">
			<fileset dir="resource:smb://test_customers/test/SFTPHome/SDS/OUTBOUND">
				<wildcardFilter>
					<include pattern="customer*.*" />
				</wildcardFilter>
			</fileset>
		</createFileList>

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

			<print file="resource:smb://test_customers/test/SFTPHome/SDS/OUTBOUND/Archive/files.txt" append="true" version="1.0" disabled="false">
				<![CDATA[${currentfile:name} ${system.carriageReturn}]]>
			</print>

		</forEachLoop>

		<copy sourceFilesVariable="${currentfile}" destDir="${system.job.workspace}" whenFileExists="overwrite" destinationFilesVariable="copiedfiles" version="1.0" disabled="false" />


		<zip inputFilesVariable="${copiedfiles}" outputFile="test.zip" outputFileVariable="zippedfiles" version="1.0" disabled="false" />


		<setVariable name="zip" value="${zippedfiles:name}" version="2.0" disabled="false" />


		<sendEmail resourceId="mail.usvendors.com" toList="[email protected]" version="2.0" disabled="false">
			<from address="[email protected]" />
			<message file="resource:smb://test_customers/testDEV/SFTPHome/tocust/OUTBOUND/Archive/files.txt">
				<![CDATA[On ${CurrentDate('MM/dd/yy')} at ${CurrentTime('hh:mm a')} central time we are sending you the following ${filecnt} files in zip file


]]>
			</message>
			<subject>
				<![CDATA[Proof of concept, e-mail generated from GOANYWHERE]]>
			</subject>
		</sendEmail>


		<delete file="resource:smb://test_customer/test/SFTPHome/tocust/OUTBOUND/Archive/files.csv" version="1.0" disabled="true" />


		<deleteWorkspace version="1.0" />

	</module>

</project>
  • Support_Rick Offline
  • Support Specialist
  • Posts: 590
  • Joined: Tue Jul 17, 2012 2:12 pm
  • Location: Phoenix, AZ
  • Contact:

Re: carriage return after extension

Post by Support_Rick »

Review the attached tweaks to your project and you'll see how you can do this. I gave you 2 ways to get your list, through printing them to a file (in Workspace) or through appending the files to a Variable (in a vertical list).

Try and see if this helps!

Code: Select all

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

   <module name="Main">

      <createWorkspace version="1.0" />

      <createFileList label="create e-mail list"
                      fileListVariable="filelist"
                      numFilesFoundVariable="filecnt"
                      version="1.0"
                      disabled="false">
         <fileset dir="resource:smb://test_customers/test/SFTPHome/SDS/OUTBOUND">
            <wildcardFilter>
               <include pattern="customer*.*" />
            </wildcardFilter>
         </fileset>
      </createFileList>

	  <setVariable label="setVar: printFiles"
	               name="printFiles"
	               value="${system.emptyString}"
	               version="2.0" />
	  
      <forEachLoop itemsVariable="${filelist}"
                   currentItemVariable="currentfile"
                   disabled="false">

		 <setVariable label="setVar: printFiles"
		               name="printFiles"
		               value="${concat( printFiles, currentFile:name, system.carriageReturn }"
		               version="2.0" />
				   
         <print file="files.txt"
                append="true"
                version="1.0"
                disabled="false">
            <![CDATA[ ${ concat( currentfile:name, system.carriageReturn } ]]>
         </print>

     </forEachLoop>

 	 <copy sourceFilesVariable="${fileList}"
 	       destDir="${system.job.workspace}"
 	       whenFileExists="overwrite"
 	       destinationFilesVariable="copiedfiles"
 	       version="1.0"
 	       disabled="false" />
	 
      <zip inputFilesVariable="${copiedfiles}"
           outputFile="test.zip"
           outputFileVariable="zippedfiles"
           version="1.0"
           disabled="false" />

      <setVariable name="zip"
                   value="${zippedfiles:name}"
                   version="2.0"
                   disabled="false" />

      <sendEmail resourceId="mail.usvendors.com"
                 toList="[email protected]"
                 version="2.0"
                 disabled="false">
         <from address="[email protected]" />
         <message file="resource:smb://test_customers/testDEV/SFTPHome/tocust/OUTBOUND/Archive/files.txt">
            <![CDATA[
On ${CurrentDate('MM/dd/yy')} at ${CurrentTime('hh:mm a')} central time we are sending you the following ${filecnt} files in zip file]]>
         </message>
         <subject>
            <![CDATA[Proof of concept, e-mail generated from GOANYWHERE]]>
         </subject>
      </sendEmail>

      <deleteWorkspace version="1.0" />

   </module>

</project>
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Post Reply