I have taken this reference from below URL, but modified some code.
http://www.catonmat.net/blog/clear-privacy-ie-firefox-opera-chrome-safari/
1. Make a .bat file and paste the following lines in that (I saved as "SafariClearCache.bat")
@echo off
set DataDir=C:\Users\%USERNAME%\AppData\Local\Applec~1\Safari
set DataDir2=C:\Users\%USERNAME%\AppData\Roaming\Applec~1\Safari
del /q /s /f "%DataDir%\History"
rd /s /q "%DataDir%\History"
del /q /s /f "%DataDir%\Cache.db"
del /q /s /f "%DataDir%\WebpageIcons.db"
del /q /s /f "%DataDir2%"
rd /s /q "%DataDir2%"
2. Now in your C# code include
using System.Diagnostics;
3. Now add following code of C#
public static void ClearSafariCache()
{
Process proc = null;
try
{
proc = new Process();
proc.StartInfo.FileName = "SafariClearCache.bat";
proc.StartInfo.CreateNoWindow = false;
proc.Start();
proc.WaitForExit();
}
catch (Exception ex)
{
Console.WriteLine("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
}
}
http://www.catonmat.net/blog/clear-privacy-ie-firefox-opera-chrome-safari/
1. Make a .bat file and paste the following lines in that (I saved as "SafariClearCache.bat")
@echo off
set DataDir=C:\Users\%USERNAME%\AppData\Local\Applec~1\Safari
set DataDir2=C:\Users\%USERNAME%\AppData\Roaming\Applec~1\Safari
del /q /s /f "%DataDir%\History"
rd /s /q "%DataDir%\History"
del /q /s /f "%DataDir%\Cache.db"
del /q /s /f "%DataDir%\WebpageIcons.db"
del /q /s /f "%DataDir2%"
rd /s /q "%DataDir2%"
2. Now in your C# code include
using System.Diagnostics;
3. Now add following code of C#
public static void ClearSafariCache()
{
Process proc = null;
try
{
proc = new Process();
proc.StartInfo.FileName = "SafariClearCache.bat";
proc.StartInfo.CreateNoWindow = false;
proc.Start();
proc.WaitForExit();
}
catch (Exception ex)
{
Console.WriteLine("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
}
}
No comments:
Post a Comment