file rename

  • I m using

    http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html

    to move and rename a file.

    help me for below expression and add date & time in below expression as it gives file name as abc-82008 and I want abc-8192008andtime

    @[User::ArchivePath] + SUBSTRING( @[User::MyFileValue] , 1 , FINDSTRING( @[User::MyFileValue],".",1) - 1 ) + "-" + (DT_STR, 2, 1252) Month( @[System::StartTime] )+ (DT_STR, 4, 1252) Year( @[System::StartTime] )+ SUBSTRING( @[User::MyFileValue] , FINDSTRING( @[User::MyFileValue],".",1) , LEN( @[User::MyFileValue] ) )

  • bang.prashant (8/20/2008)


    I m using

    http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html

    to move and rename a file.

    help me for below expression and add date & time in below expression as it gives file name as abc-82008 and I want abc-8192008andtime

    @[User::ArchivePath] + SUBSTRING( @[User::MyFileValue] , 1 , FINDSTRING( @[User::MyFileValue],".",1) - 1 ) + "-" + (DT_STR, 2, 1252) Month( @[System::StartTime] )+ (DT_STR, 4, 1252) Year( @[System::StartTime] )+ SUBSTRING( @[User::MyFileValue] , FINDSTRING( @[User::MyFileValue],".",1) , LEN( @[User::MyFileValue] ) )

    Isolating just your date/time format question: (where AteTimeVar is a general datetime variable)

    RIGHT("0" +(DT_WSTR,2)MONTH(@[User::ateTimeVar]), 2) + RIGHT("0" + (DT_WSTR,2)DAY(@[User::ateTimeVar]), 2) +

    (DT_WSTR,4)YEAR(@[User::ateTimeVar])+

    (DT_WSTR,2)DATEPART("Hh",@[User::ateTimeVar]) +

    (DT_WSTR,2)DATEPART("mi",@[User::ateTimeVar])

    will produce: 082120081532 where date is 8/21/2008 and time is 15:32

  • ok, can you tell me how to check if file exists , then rename and move in step using same link?

  • The ForEach loop will return the file name when the file matches the pattern given in Files field (e.g. *.txt will search all txt files in the given folder). You can set the pattern to check for specific files in the directory.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply