Hi,
I have one class and three methods.I am using directory info for get the path of the file in the first method.i want to use this directory info value to third method.if i use root,uns,su in third method i got error.How to resolve this.Please post sample code.
my code is
protected void import(object sender, EventArgs e)
{
XmlDocument xmlDoc = new XmlDocument();
DirectoryInfo root = new DirectoryInfo(Server.MapPath("."+@"\Received Files"));
DirectoryInfo uns = new DirectoryInfo(Server.MapPath("." + @"\undone files"));
DirectoryInfo su = new DirectoryInfo(Server.MapPath("." + @"\successfully inserted files"));
FileInfo[] listfiles = root.GetFiles("*.xml");
}
void move(int i)
{
if (i == 1)
{
srcfile = root + @"\" + file.Name;
srcfil = srcfile.Replace("\\", @"\");
undonefile = uns + @"\" + file.Name;
undone = undonefile.Replace("\\", @"\");
System.IO.File.Move(srcfil, undone);
}
if (i == 2)
{
srcfile = root + @"\" + file.Name;
srcfil = srcfile.Replace("\\", @"\");
getdestinationFile = su + @"\" + file.Name;
destinationFile = getdestinationFile.Replace("\\", @"\");
System.IO.File.Move(srcfil, destinationFile);
}