Move files newly created files from an existing folder
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts
Page 1 of 1
We have this requirement to move newly created files from an Archive folder that contains files from over a year.
While doing so, is their a way to completely avoid the ForEachLoop ?
We are working under restrictions for e.g we cannot modify the existing folder structure.
I am aware that a monitor can be used to detect new files, but how can the job decide which files are created say 'today' and transfer only those?
While doing so, is their a way to completely avoid the ForEachLoop ?
We are working under restrictions for e.g we cannot modify the existing folder structure.
I am aware that a monitor can be used to detect new files, but how can the job decide which files are created say 'today' and transfer only those?
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
The best solution is to determine your CutOff date ...
ie, Cutoff = Today - 30 days.
Then create a file list across your Archive folder structure generating a file list and only include files dated up to and including your Cutoff date.
Something like the following:
No ForEach loop is needed to delete those files unless you want to do each individually.
This can be called from a Scheduled Job to run once a week or once a month ... a Monitor isn't needed.
ie, Cutoff = Today - 30 days.
Then create a file list across your Archive folder structure generating a file list and only include files dated up to and including your Cutoff date.
Something like the following:
Code: Select all
Now you have the Number of files that were found (NoFilesToDelete) that matches your Cutoff criteria, and you have a FileList (FilesToDelete) that you can do whatever you need with that identified list.<timestamp version="1.0">
<format outputVariable="Cutoff" pattern="yyyy-MM-dd" dayOfMonth="-30" />
</timestamp>
<createFileList label="Get files to Delete" fileListVariable="FilesToDelete" numFilesFoundVariable="NoFilesToDelete" version="1.0">
<fileset dir="\\MyArchive\MyFolder\MySubFolder" recursive="true">
<dateFilter>
<include to="${Cutoff}" />
</dateFilter>
</fileset>
</createFileList>
No ForEach loop is needed to delete those files unless you want to do each individually.
This can be called from a Scheduled Job to run once a week or once a month ... a Monitor isn't needed.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts
Page 1 of 1