Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 error message from a system file task move a fil

Author  Topic 

sarahmfr
Posting Yak Master

214 Posts

Posted - 2011-08-21 : 23:35:23
Hi all,
Please I need help
Hi 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 archivefiles

archivefilename=replace( @[User::filename],"datafiles","archive")

orginalfiles connection is an expression =@user:filename

archivefies connection is an expression=@user:archivefilename

the filename comes from reading the folder that contains those files

public 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\ exists

why I am getting this error

My filesystem task : destinationpathvariable =false

destinationconnection:archivefile

overwrite=true

operation=movefile

issourcepathvariable=false

sourceconnection=original file

why 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 exist

sarah

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 MVP
http://visakhm.blogspot.com/

Go to Top of Page

sarahmfr
Posting Yak Master

214 Posts

Posted - 2011-08-21 : 23:48:33
yes,I have tried that also but it did not work
I put the source and destination as variable
the their values are user:filename
and the destination is user:archivefilename
What am i doing wrong



sarah
Go to Top of Page

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 MVP
http://visakhm.blogspot.com/

Go to Top of Page

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 variables
How can I make my file read only until I move it than change that after moving it ? would that help
Pleas I need help

sarah
Go to Top of Page

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 archivefilename

sarah
Go to Top of Page

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 that
Thanks

sarah
Go to Top of Page

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 MVP
http://visakhm.blogspot.com/

Go to Top of Page

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
Go to Top of Page

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 MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -