Moving files from a list of files

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

EdWyche

Posts: 4
Joined: Thu Jul 31, 2014 3:43 pm

Post by EdWyche » Thu Jun 18, 2015 9:13 am
II have a list of files that are read in using the Create File List task. I loop through the files to send them out after the are sent out I want to check part of the filename and it equals that part move it to another folder. If it does not equal part of that filename skip it and leave the files where it is at. Any suggestions would be appreciated.

Support_Julie

User avatar
Support Specialist
Posts: 91
Joined: Thu Mar 05, 2009 3:49 pm
Location: Ashland, NE USA

Post by Support_Julie » Fri Jun 19, 2015 2:05 pm
Inside your loop, set a variable for the file name.
Then add an IF statement to check for the substring.
If the substring exists, then you can move it.
I have attached a simple project that checks for a file name that starts out with "Linoma".


Code: Select all
<project name="checkFileName" mainModule="Main" version="2.0">

	<module name="Main" logLevel="debug">

		<createFileList fileListVariable="fileList" numFilesFoundVariable="fileCount" version="1.0">
			<fileset dir="/MyFolder/" />
		</createFileList>

		<forEachLoop itemsVariable="${fileList}" currentItemVariable="thisFile">

			<setVariable label="MyFileName" name="MyFileName" value="${thisFile:nameWithoutExtension}" version="1.0" />

			<if condition="${(Substring(MyFileName, 1, 6) == &apos;Linoma&apos;)}">

				<print version="1.0">
					<![CDATA[**
the file contained the string
this is where you would add your copy/move file task
**]]>
				</print>

			</if>
		</forEachLoop>
	</module>

</project>
Julie Rosenbaum
Sr Support Analyst
e. goanywhere.support@helpsystems.com
p. 1.800.949.4696
w. HelpSystems.com

EdWyche

Posts: 4
Joined: Thu Jul 31, 2014 3:43 pm

Post by EdWyche » Wed Jun 24, 2015 2:43 pm
This worked great thank you.
3 posts Page 1 of 1