The simplest way to get that sort of information is to use the .NET Framework's System.IO.FileInfo
class in a Script Task:
public void Main()
{
var receivedFile = (string)Dts.Variables["User::ReceivedFile"].Value;
var fileInfo = new System.IO.FileInfo(receivedFile);
Dts.Variables["User::FileName"].Value = fileInfo.FullName;
Dts.Variables["User::FileSize"].Value = fileInfo.Length;
Dts.Variables["User::ReceivedDate"].Value = fileInfo.CreationTime;
// or whatever other information you may need
Dts.TaskResult = (int)ScriptResults.Success;
}
The code above assumes that you've set the User::ReceivedFile
variable to the full path of whatever file you're dealing with; this is typically (but not always) done through a File System Task. Obviously, when configuring the Script Task, you'll need to specify ReadWrite
access for the variables you'll be writing to.
Once you have that information in variables, of course, you can use it in whatever manner is needed.
For further information on the FileInfo
class, see MSDN here.