Author |
Topic |
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2011-08-21 : 23:35:23
|
Hi all,Please I need helpHi all,I am having a list of files in a folder named datafiles and I am processing them one by one when I finish each one I want to move the file into a folder archive.I am having a variable named filename and archivefilename and two fileconnections one is originalfiles and archivefilesarchivefilename=replace( @[User::filename],"datafiles","archive")orginalfiles connection is an expression =@user:filenamearchivefies connection is an expression=@user:archivefilenamethe filename comes from reading the folder that contains those filespublic void Main() { string[] filenames; filenames = Directory.GetFiles(@"C:\luminis\datafiles\"); Array.Sort(filenames); Dts.Variables["filelist"].Value = filenames; Dts.TaskResult = (int)ScriptResults.Success; } }The folder c:\luminis\archive\ existswhy I am getting this errorMy filesystem task : destinationpathvariable =falsedestinationconnection:archivefileoverwrite=trueoperation=movefileissourcepathvariable=falsesourceconnection=original filewhy am i getting this error[File System Task] Error: An error occurred with the following error message: "Could not find a part of the path.".Although the two folder do existsarah |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-21 : 23:42:50
|
you're passing path from a variable rite? then you need to set destinationpathvariable =true------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2011-08-21 : 23:48:33
|
yes,I have tried that also but it did not workI put the source and destination as variable the their values are user:filenameand the destination is user:archivefilenameWhat am i doing wrongsarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-22 : 00:13:41
|
check what value you're getting from variable. Open the package in BIDS and run it in debug mode. put a breakpoint on pre execute of file system task and when it hits breakpoint check the values of user:filename and user:archivefilename------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2011-08-22 : 00:48:30
|
I tried that The file names are there. Both the archive and original file . I even add a script task before the file system task to display the values of both variablesHow can I make my file read only until I move it than change that after moving it ? would that help Pleas I need helpsarah |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2011-08-22 : 00:50:23
|
I even added code in a script task before the filesystem task to set the value of the variable archivefilenamesarah |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2011-08-22 : 00:54:05
|
If I change the move to copy it works ie it copies the file. It seems something with readonly. How to resolve thatThankssarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-22 : 00:56:56
|
if you want to make it read/write you need to do it in script task by creating an object for file system------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
sarahmfr
Posting Yak Master
214 Posts |
Posted - 2011-08-22 : 01:01:43
|
How can I do that(it read/write you need to do it in script task by creating an object for file system)?Currently I changed the move to copy then at the end of the process I deleted the file and it worked but of course that is not so professional.sarah |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-22 : 01:14:53
|
one question . are the paths your local paths? are you running the package on your local machine or server?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|