May 13, 2009 at 7:45 am
Hello-
I'm trying to create a simple file system task that moves a file to a destination and appends the current date to the file name after it reaches the destination.
May 13, 2009 at 8:27 am
I think the problem is with the variable mapping of for each loop container...
Shouldn't this "Variable Mappings = User::Dest_file" be "Variable Mappings = User::Src_File"?
--Ramesh
May 13, 2009 at 9:25 am
Errrrrr.. Same error after changing 🙁
May 13, 2009 at 9:57 am
I suggest you do it without using connections.
1. Create variable "SourceDir" to hold source directory
2. Create variable "SourceFilePath" to hold current file path
3. Create variable "TargetDir" to hold target directory
4. Create variable "TargetFilePath" to hold target directory. This should be a calculated value and should use the formula
@[User::TargetDir] + "\\" + RIGHT( @[User::SourceFilePath], FINDSTRING( REVERSE( @[User::SourceFilePath] ), "\\", 1 ) - 1 )
File system Task Editor:
IsDestinationPathVariable = True
DestinationPathVariable = TargetFilePath
OverwriteDestinition = True
Operation = Move file
IsSourcePathVariable = True
DestinationPathVariable = SourceFilePath
Foreach Loop Editor:
Folder = SourceDir
Files = *.cur
Retrieve file name = Fully qualified name
Variable Mappings = SourceFilePath
Note that, I'll be adding the current timestamp to the destination once the above part works properly.
--Ramesh
May 13, 2009 at 10:14 am
Attached are screen shots of the environment I'm working with. Any input is appreciated.
May 13, 2009 at 10:15 am
2nd batch
May 13, 2009 at 10:16 am
3rd
May 13, 2009 at 11:48 am
So all I'm wanting to do is move a file called UIVIN.MAKEFILE.CUR from D:\Inbound to D:\Inbound\Archived
I have a hunch the issue has to do with the expression within my DestConn that's causing this.
Any thoughts?
May 14, 2009 at 1:39 am
I don't think there's any issue with the expression but could be a problem with the destination connection settings. Can you post the screenshot of the destination connection as well?
BTW, have you tried my other solution?
--Ramesh
May 14, 2009 at 5:17 am
Hi Ramesh,
Yes I did try what you suggested and I got the same results. Attached is a screenshot of of the DestConn string. I
f you notice on the connection string line it appends the date 200905140708.CUR to the file. I suppose that's being triggered by the expression.
Thanks
May 14, 2009 at 6:19 am
Okay, I've found the place where the problem lies. Its "Operation" property of "File System Task" which should be "Rename file" instead of "Move file".
"Move file" Operation does not support renaming and moving files at the same time. It just moves the a file from one location to another whereas "Rename file" supports both the operations.
And "Move file" Operation expects a directory path in "Destination Connection/Variable" property and appends the "Source File Name" to this value. That's why you're getting an trailing file name in the destination variable.
--Ramesh
May 14, 2009 at 7:40 am
Ramesh (5/14/2009)
May 14, 2009 at 7:51 am
Another thought.. I was under the assumption that I should use move file and the DestConn's expression takes care of the renaming i.e. appending date stamp to the file. I could be wrong though.
May 14, 2009 at 9:25 am
I don't know why it is not working at your end, but it works fine at my machine. I've attached a sample package that I've created.
Let us know if it works for you.
--Ramesh
May 14, 2009 at 1:30 pm
Ramesh (5/14/2009)
I don't know why it is not working at your end, but it works fine at my machine. I've attached a sample package that I've created.Let us know if it works for you.
Ramesh, with a little tweaking with the code to reflect my environment it worked.
I never thought about doing away with Connection Managers.
Thanks for all your input!!!
Viewing 15 posts - 1 through 15 (of 30 total)
You must be logged in to reply to this topic. Login to reply