Solved

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

Posted on 2010-11-09
6
564 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:the_b1ackfox
  • 3
  • 3
6 Comments
 
LVL 6

Expert Comment

by:r3nder
ID: 34099303
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
 
LVL 9

Author Comment

by:the_b1ackfox
ID: 34100540
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
 
LVL 6

Accepted Solution

by:
r3nder earned 500 total points
ID: 34102444
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 9

Author Comment

by:the_b1ackfox
ID: 34142116
still working on putting this into testing...  weird part, is I now have it running on a defferent computer...  
0
 
LVL 6

Expert Comment

by:r3nder
ID: 34142291
Odd, let me know all the symptoms so I can better understand whats going on and get you up and running :)
Thanks
R3nder
0
 
LVL 9

Author Comment

by:the_b1ackfox
ID: 34478130
R3nder... sorry about that, I didn't mean to not get back to you.  I am awarding you points and an apology!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now