Leopardfist
Member
- Joined
- Nov 25, 2014
- Messages
- 14
- Programming Experience
- Beginner
Hi, and thank you for assiting me. First off what I need to do, since I am very new to C# and there is almost certainly a better way to accomplish the task I am trying to accomplish.
First, the user will supply a path to a directory. For example: \\server\users\name
Now, I want to delete several folders from thsi directory, IF THEY EXIST. The tricky part is, one of those always has a different name, but that name always starts with ICAClient. Its typically something like ICAClientx8f7s6e0s538fj50 etc etc.
I need to to know if I can do a Directory.Exists(path + "*"); to return the exact filename, so that I can then do a Directory.Delete(newpath, true);
Now, if there is a better way, I am very open to suggestions. Below are the exact folders I need to delete. path variable will be the base path.
path + "CitrixTemp\"
path + "ProfileUnity\"
path + "Cookies\" (I need to delete everything inside this folder EXCEPT the .dat files, as they will be locked due to user being logged in.) not sure of a foreach with this exception.
path + "Application Data\Citrix\"
path + "Application Data\ICAClient\"
path + Application Data\ICAClient*\"
path + Application Data\Sun\"
Those are everything I need to delete in my program when my button is clicked.
THANKS for any assistance, and to every, have a SAFE and HAPPY THANKSGIVING!
Oh Sorry, I am using VS2013 express and writing this little program for Windows XP and Windows 7 boxes.
First, the user will supply a path to a directory. For example: \\server\users\name
Now, I want to delete several folders from thsi directory, IF THEY EXIST. The tricky part is, one of those always has a different name, but that name always starts with ICAClient. Its typically something like ICAClientx8f7s6e0s538fj50 etc etc.
I need to to know if I can do a Directory.Exists(path + "*"); to return the exact filename, so that I can then do a Directory.Delete(newpath, true);
Now, if there is a better way, I am very open to suggestions. Below are the exact folders I need to delete. path variable will be the base path.
path + "CitrixTemp\"
path + "ProfileUnity\"
path + "Cookies\" (I need to delete everything inside this folder EXCEPT the .dat files, as they will be locked due to user being logged in.) not sure of a foreach with this exception.
path + "Application Data\Citrix\"
path + "Application Data\ICAClient\"
path + Application Data\ICAClient*\"
path + Application Data\Sun\"
Those are everything I need to delete in my program when my button is clicked.
THANKS for any assistance, and to every, have a SAFE and HAPPY THANKSGIVING!
Oh Sorry, I am using VS2013 express and writing this little program for Windows XP and Windows 7 boxes.