C# Read\write access to the programs files directories in XP

Hello Experts,

I have a self-repairing application that requires access to a folder under the program files directory.  Weebo (yeah, I named it after the maintenance droid in flubber...), checkes the App folder (c:\program files\bob\), deletes all of the template files, then copies current template files.

Any discussion of technique is moot for this particular application, but par for the course for future endeavors...  Anyways, I know it worked on most machines until recently.  The weird thing is that it works on a PC pacted up to SP3, but not on a system that was loaded with SP3 (and then Weebo is installed)

Can someone tell me how to get control of my directory back?  It is a big endevor to fix this otherwise.
LVL 9
the_b1ackfoxCIOAsked:
Who is Participating?
 
r3nderCommented:
use try catch statements and print the error to the screen - my first thought is that it is going to be "run as administrator" issues
0
 
r3nderCommented:
protected void CleanImageFolder()
{
    string imgFolder = Server.MapPath("~/lab/maskemail/img/");
    string[] imgList = Directory.GetFiles(imgFolder, "*.jpg");
    foreach (string img in imgList)
    {
        FileInfo imgInfo = new FileInfo(img);
        if (imgInfo.LastWriteTime < DateTime.Now.AddMinutes(-3))
        {
            imgInfo.Delete();
        }
    }
}
0
 
the_b1ackfoxCIOAuthor Commented:
I had originally asked this question as I was running out the door from work, and I have come to realize that my question isn't very well stated.  So I am going to try and restate it now.

My App (weebo) is crashing on some Windows XP systems while it is trying to delete files.  I initially thought that it wasn't deleting any files at all...   but upon further inspection, it seems as though some of the files are deleted indeed.

Since it works flawlessly on a few systems, I figured the problem was systemic (and it is, just not how I thought)  It is systemic in the fact that I stopped troubleshooting, because I thought the problem was with the OS updates.

I now think the answer lies in adding logging functionality, and trapping/debugging the errors...  :)
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
the_b1ackfoxCIOAuthor Commented:
still working on putting this into testing...  weird part, is I now have it running on a defferent computer...  
0
 
r3nderCommented:
Odd, let me know all the symptoms so I can better understand whats going on and get you up and running :)
Thanks
R3nder
0
 
the_b1ackfoxCIOAuthor Commented:
R3nder... sorry about that, I didn't mean to not get back to you.  I am awarding you points and an apology!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.