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
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 Specialist
- Posts: 91
- Joined: Thu Mar 05, 2009 3:49 pm
- Location: Ashland, NE USA
-
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".
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) == 'Linoma')}">
<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>
3 posts
Page 1 of 1