I'm trying to create a console uninstaller for my friends, since they use addons for left 4 dead, and I am trying to make this to remove them before they update.. heres the code so far

using System;
using System.IO;

class Test 
{
    
    public static void Main() 
    {
        // Specify the directories you want to manipulate.
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui/l4dr_logo.vmt";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3";
        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3";
        string path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3";
        


        try 
        {
            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam/steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg")) 
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam/steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");
            }


            // Determine whether the directory exists.
            if (!Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles"))
            {
                // Delete Directory
                Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");
            }

 
            // Determine whether the directory exists.
            if (!Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts"))
            {
                // Delete Directory
                Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");
            }



            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui/l4dr_logo.vmt"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui/l4dr_logo.vmt");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3"))
            {
                // Delete Directory
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3"))
            {
                // Delete File
                File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");
            }


            // Determine whether the directory exists.
            if (!Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles"))
            {
                // Delete Directory
                Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");
            }


            // Determine whether the directory exists.
            if (!Directory.Exists(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts"))
            {
                // Delete Directory
                Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");
            }

            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");
            }


            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");
            }

            // Determine whether the File exists.
            if (!File.Exists(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3"))
            {
                // Delete File
                File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
            }


            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");
            Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");
            Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui/l4dr_logo.vmt");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui/l4dr_logo.vmt", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
            File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");
            Directory.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");
            Directory.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted. 
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3", true);
            Console.WriteLine("The Delete operation was successful.");

            // This will succeed because subdirectories are being deleted.
            Console.WriteLine("Uninstallation is in progress", @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
            File.Delete(@"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3", true);
            Console.WriteLine("The Delete operation was successful.");


        } 
        catch (Exception e) 
        {
            Console.WriteLine("What's this bullshit? a bug, you may need to retry manually: {0}", e.ToString());
        } 
        finally {}
    }
}

now the problem is, it wont let me use 'path' multiple times, and... it says i need an overload 2+ or something for file.delete

File.Delete only takes 1 parameter and you've supplied two. Get rid of all the 'true's.

awesome, that part worked, thanks. but what about

string path = @"C:\..."

it wont let me use 'path' its saying "a local variable named path is already defined in this scope

Well, that's because it is. You can use path again, you just can't define it again. So while you have

string path = @"blah...";
string path = @"blah...";

you would want

string path = @"blah";
path = @"blah"

Do note that you really can't change it the way you are doing it (all the lines up front) because it will only have the last value you set it to when you are done. You could do this

string path = @"blah 1";
Console.WriteLine("Deleting {0}", path);
File.Delete(path);

path = @"blah 2";
Console.WriteLine("Deleting {0}", path);
File.Delete(path);

etc

Or, even better would be

string[] paths = { @"path 1", 
                   @"path2", 
                   @"path3" };

foreach path in paths {
    Console.WriteLine("Doing something with {0}", path);
    File.Delete(path);
}

The last sample there means you'll only have one delete, you just use it over and over again.

ok, i made some changes.. but now im getting a green line saying "the variable 'path' is assigned but its value is never used"

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Beta_2
{
    class Program
    {
        public static void Main(string[] args)
        {

        string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");
        Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");
        Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");

        path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");
        Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");
        Directory.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_scripts");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vmt");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\materials\vgui\l4dr_logo.vtf");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\l4d_crashcourse_bg.bik");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\media\StartupVids.txt");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\HUD\TeammatePanel.res");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\resource\UI\L4D360UI\MainMenu.res");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup1.mp3");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup2.mp3");

        path = @"E:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3";
        Console.WriteLine("Deleting {0}", @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
        File.Delete(@"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\sound\UI\gamestartup3.mp3");
        }
    }
}

OK. I fixed this (again), but now.. will I need to add in an exception? for if it cant be found on "C:\Program Files (x86)\...." and tell it to go to "E:\Program Files (x86)\...." or will it skip it?

edit: ok, well now I need to make an exception for like "if not found at C:\, go to E:\" so it doesn't crash.. aswell as an exception IF the files are already deleted, then it close without it halting and windows saying not responding.. I also need an exception to stop if found on C:\ and not on E:\

like: you use it on C:... it deletes it from C:...., it looks on E:.... does not find it on E...., it closes without CRASHING, and vise versa, installed on E:... deletes from E:, looks on C:.. doesn't find it and closes.

You still aren't using the path variable, so why are you creating it? Change your code (for one example) to

string path = @"C:\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg";
Console.WriteLine("Deleting {0}", path);
File.Delete(path);

File.Delete does not throw an exception if it doesn't find the file, so you'll need to use File.Exists to check.

And you really should use an array, it will shorten your code dramatically:

using System;
using System.IO;

namespace vG_Uninstaller {
    class Program {
        public static void Main(string[] args) {
            string[] files = { @"\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\autoexec.cfg",
                               @"\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles\d1.cfg", 
                               @"\Program Files (x86)\Steam\steamapps\common\left 4 dead\left4dead\cfg\l4d_glow_profiles\d2.cfg"
                             }; // You'd add the rest of the files without the drive letter
            string[] drives = {"C:", "D:", "E:"};

            foreach (String file in files) {
                foreach (String drive in drives) {
                    if (File.Exists(drive + file)) {
                        Console.WriteLine("Deleting {0}", drive + file);
                        try {
                            File.Delete(drive + file);
                        } catch (IOException e) {
                            Console.WriteLine("Delete failed because some other software is using the file");
                        } catch (UnauthorizedAccessException e) {
                            Console.WriteLine("Delete failed because: User doesn't have permissions to delete the file or the file is read only");
                        }
                        break;
                    }
                }
            }
       }
    }
}

alright, i'll try that.. I mean it's working and everything, even with the 'string path' in there, just need to correct the unhanded exceptions now

edit: so you are saying where you have (path) it should say path and not the file path? i only get the green line where 'string path =' is

edit: so you are saying where you have (path) it should say path and not the file path? i only get the green line where 'string path =' is

Correct, it's telling you that you aren't using it, just assigning a value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.