You will probably come across a file that is formatted like this
where we are dealing with the full timestamp in the name. As long as the file is the only file in the directory, we can use the script below:
Function Main()You now have the full path and filename in the global variable. Now, if there are multiple files in the directory, you will have the last file name in the global variable.
Set objFSO =
objStartFolder = "\\DriveName\FolderName\"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
DTSGlobalVariables ("gv_FileName").Value =
objStartFolder & objFile.Name
Main = DTSTaskExecResult_Success