For Each Loop Container copy and rename files a sequential number

  • I used File System Task, the operation rename, and then use en the variable of FullDestinationPathFileName: "@[User::ArchivePath] + (DT_STR, 30, 1252) (@[User::counter]) + SUBSTRING( @[User::MyFileValue] , FINDSTRING( @[User::MyFileValue],".",1) , LEN( @[User::MyFileValue] ) ) ". And Iยดm using other variable (@[User::counter]), and the expressions of variable Iยดm trying to add one: (@[User::counter])=(@[User::counter]+1, because I want to rename each destinations files rename like: 1.xls, 2.xls, 3.xls, like sequential way, but I have an error ๐Ÿ™

    Please any help.

    How Can I rename the several files that have been to copy a destination files, and put one by one with sequential numbers?

    Really I appreciated.

  • Well, what error are you getting?

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Hello,

    The error is: "Expression cannot be evaluated"

    Additional Information:

    -> Reading the variable "User::counter" failed with error code 0XX001F188.

    (Microsoft.DataTransformationServices.Controls)

    Thank U by Your help ๐Ÿ™‚

  • Make sure you type cast your counter variable as string....otherwise, you cannot include it in your string variable.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Expressions allow you to use variables, but not to assign their values.


  • Phil Parkin (3/22/2010)


    Expressions allow you to use variables, but not to assign their values.

    Yep, Phil's correct. I did not see the assignment. You'll need to increment your variable somewhere else in the loop container. Then you can use the variable to build out your string for the file name. When you do this, make sure you type cast the counter variable to string.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Thank U again,

    Please, Im new in this, someone idea how can I to get one variable that it goes to increment with a for each loop conatiner, each time that to copy one by one the files? And then can I to include this variable in the complete string of the FullArchivePathFileName.

    In this string I write with this cast: (DT_STR, 30, 1252) (@[User::counter]) Is It right?

    I apreciated Your Help ๐Ÿ™‚

Viewing 7 posts - 1 through 7 (of 7 total)

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