File Move to Sub Directory
Posted: Mon Sep 13, 2010 6:15 pm
How do I move the File to sub directories based on File name meta data.
My File would be in the format /usr/work/ABCD-xyz-123.txt
That needs to be Moved to /usr/work/ABCD/ABCD-xyz-123.txt
FTP Server is GoAnywhere Services.. (In case, I can do this directly using Triggers please suggest)
Here is a Sample Project... That I envision. (Please suggest any other way that this can be achieved).
My File would be in the format /usr/work/ABCD-xyz-123.txt
That needs to be Moved to /usr/work/ABCD/ABCD-xyz-123.txt
FTP Server is GoAnywhere Services.. (In case, I can do this directly using Triggers please suggest)
Here is a Sample Project... That I envision. (Please suggest any other way that this can be achieved).
Code: Select all
<project name="MovetoSub" mainModule="Main" version="1.0">
<module name="Main">
<ftp version="1.0" resourceId="FTP Server">
<list label="FilestoMove" fileListVariable="FilestoMove">
<fileset dir="/usr/work" recursive="false">
<wildcardFilter>
<include pattern="*IncludePattern*" />
</wildcardFilter>
</fileset>
</list>
</ftp>
<forEachLoop itemsVariable="${FilestoMove}" currentItemVariable="currFile">
<setVariable version="2.0" label="DirName" value="????" />
<ftp version="1.0" resourceId="FTP Server">
<mkdir dir="/usr/work/${DirName}" />
<move sourceFile="${currFile}" destinationFile="/usr/work/${DirName}/${currFile:file} />
</ftp>
</forEachLoop>
</module>
</project>