April 16, 2010 at 10:41 am
Hi,
I want to rename a file without moving in file system task for varying file names.
file names chnages with the datetimestamp. - file120100416. source and destination is the same folder.
Thank you,
VG
April 16, 2010 at 12:08 pm
Quite honestly, I can never get the file system task to work the way I want it to so I wind up using a script task instead and pass in the path and old file name. There is a rename method you can call inside the system.io class.
Dim fileName As String
Dim folderName As String
Dim newFileName As String
Dim oldFileName As String
Dim modFileName As String
fileName = Dts.Variables("fileName").Value.ToString()
folderName = Dts.Variables("newFolderLocation").Value.ToString()
modFileName = Date.Now.Year.ToString() + Right("0" + Date.Now.Month.ToString(), 2) + Right(("0" + Date.Now.Day.ToString()), 2) + "_" + fileName.ToString()
oldFileName = folderName + fileName
newFileName = folderName + modFileName
Rename(oldFileName, newFileName)
April 16, 2010 at 12:51 pm
I rarely use the filesystem task myself..
CEWII
April 16, 2010 at 1:07 pm
Yes, I agree with you in handling the expressons in file system task in such a pain. Thanks for the script and I used script task and midified the way I want it..It works..Hurray!!!!!
-VG
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply