hey guys i’m getting desperate about my little application which is why i’m asking for advice here now
the point is that my application should empty a folder but i don’t want to specify C:USERNAME in the source but the consone should use the startpath of the debug folder do you understand?
I would like to change what I have marked in bold so that it works on every pc and not just on my pc
my code that also works but I don’t want to have the whole path:
Console.ForegroundColor = ConsoleColor.Magenta;
Console.Title = ("Cachecleaner");
Thread.Sleep(2000);
**DirectoryInfo Cache = new DirectoryInfo("C:\Users\BA55H4XQR\source\repos\CacheWeb\CacheWeb\bin\Debug\Cache\EBWebView");**
foreach (FileInfo files in Cache.GetFiles())
{
files.Delete();
Console.WriteLine("Files Deleted");
}
foreach(DirectoryInfo folders in Cache.GetDirectories())
{
folders.Delete(true);
Console.WriteLine("Folders Deleted");
}
DirectoryInfo Cache = new DirectoryInfo(“C:UsersBA55H4XQRsourcereposCacheWebCacheWebbinDebugCacheEBWebView”);
Giovanni Marucchio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.