I made a program and used hard coded directories while in the making of it.
It is now complete and i was wandering if i can possibly get some help.
On one of my buttons i was copying a folder from one location to another. I was using the following formula:
//Copy Folder
if (Directory.Exists(@"C:\PROGRA~1\OLD\Docs"))
Directory.Delete(@"C:\PROGRA~1\OLD\Docs", true);
{
foreach (string dirPath in Directory.GetDirectories(@"C:\PROGRA~1\NEW\Docs", "*", SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath.Replace(@"C:\PROGRA~1\NEW\Docs", @"C:\PROGRA~1\OLD\Docs"));
foreach (string newPath in Directory.GetFiles(@"C:\PROGRA~1\NEW\Docs", "*.*", SearchOption.AllDirectories))
File.Copy(newPath, newPath.Replace(@"C:\PROGRA~1\NEW\Docs", @"C:\PROGRA~1\OLD\Docs"));
}
So in the the above i remove the old folder, copy all subfolders and files in NEW to OLD. However now that i am not using the hardcoded path how would i determine it now?
I use this for my new paths:
string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
string NEW = Path.Combine(programFiles, @"NEW");
string Docs = Path.Combine(NEW, @"Docs");
Is their a way i can use
string Docs = Path.Combine(WolfETFolder, @"Docs");in the first method i posted? or a work around that uses program files for 32bit and 64?

New Topic/Question
Reply



MultiQuote







|