Hi Madeleine & Welcome,
Short Answer, Perhaps for safety just use LastLine (Version 7) on a Set Variable Task to take the last result (a single result for safety) and set it to a variable on the next task:
{STRING(LastLine|{TASK(PrevTask,Result.CopiedFilesDestination)})}
You can then use the Variable as a parameter to your script.
Per above, the order of the FileCopy / File List if you ever get more than 1 result will be alpha order not last written ?
--- *** ---
Plan (b)
Key to your issue is controlling the File selection as you want the last file (written ?)
File List will show you the files, and file copy using the parameters you are *should* give you the single result you are looking for, but ordering is a feature request I think (Alpha sort at present ?)
One Suggestion is Use a Short Powershell Line + a VisualCron Powershell Task to find what you want.
Sorry in advance if you know powershell, I have verbosed out an example based on something else I had as we are using multiple pipes here
-- snip --
# List the Files "Get-Childitem"
# Nominate Directory (Or Use VisualCron Variable Here)
# Not Subdirectories "?{-not $_.PsIsContainer}"
# Sorted by Last File Written "Sort LastWriteTime"
# Get the last file "Select -Last 1"
$GetLatestFile = Get-Childitem "C:\Batch" | ?{-not $_.PsIsContainer} | Sort LastWriteTime | Select -Last 1
# Write Output Result to return to VisualCron for use in later tasks
# FullName = Directory + FileName
Write-Output $GetLatestFile.FullName
-- snip --
You can then use VisualCron Path Variables to slice and dice that if you wish.
Sort in Powershell has a lot of flexibility so if this (LastWriteTime) isn't to your taste perhaps one of the other file attributes will hit the spot.
http://technet.microsoft...us/library/ee176968.aspx We have had a lot of success with VisualCron tasks, supplemented with some limited powershell, replacing existing long form scripts (in powershell and other legacy script languages - cmd / bat).
Good Luck !
Kevin
Edited by user
2013-08-12T03:23:46Z
|
Reason: Plan a & plan b - Verbose up the comments on the Powershell
KJDavie attached the following image(s):