rename and move file from source to archive

  • i have specified all the values in my tasks. can you go over them and let me know where the error might be. i checked the path names for all the expressions and they look correct to me.

    the files- file1.txt,file2.txt and file3.txt are in sample folder( source) and need to renamed and moved to archive folder(dest)

    These are the variables that i am using for this job:

    foreach loop container:

    enumerator: for each file enumerator

    folder = d:\sample

    files = *.txt

    variables mapping = user::myfilevalue

    file system task:

    isdestinationpathvariable = true

    destinationvariable = User::fulldestpathfilename

    operation = rename

    issourcepathvariable = true

    sourcevariable = User::fullsourcepathfilename

    variables:

    myfilevalue = file1.txt

    dest path = d:\archive

    source path = d:\sample

    fullsourcefilepathname = @[user:: sourcepath] + @[user:: myfilevalue]

    fulldestfilepathname = @[user:: destpath] + substring( @[User::myfilevalue],1,findstring( @ [User::myfilevalue],".",1)-1) + "-" + (DT_WSTR,2)month( @[System::StartTime]) + (DT_WSTR,2) day( @[System::StartTime]) + (DT_WSTR,4)year( @[System::StartTime]) + substring( @[User::myfilevalue], findstring( @[User::myfilevalue], ".",1) , LEN( @[User::myfilevalue] ))

    it will show below errow

    [File System Task] Error: An error occurred with the following error message: "The path is not of a legal form.".

    i know there is some very simple error involved and this is supposed to be an easy one but somehow cant resolve it.

    Regards

    praveen

  • Try adding another backslash to your file folders. Example:

    d:\samples\

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • HI'

    it will show the same error when i changed the pathh means "c:\samples\"

    can u help in this one and

    where i need to set evaluatedas expression as TRUE

    THANKS

    Praveen

  • "\" is treated as an escape character .... You always need to add another "\" to escape the other one...

    it should be C:\\Sample

  • you can change the variable properties by clicking on the variable and then go to the properties window editor..change the Propertyvalue to "TRUE"

  • divyanth (2/24/2010)


    "\" is treated as an escape character .... You always need to add another "\" to escape the other one...

    it should be C:\\Sample

    I thought this was only necessary in expressions, not in variable values. Or am I mistaken?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 6 posts - 1 through 5 (of 5 total)

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