我正在爲基於unix的/樣式化的系統創建一個類似CCleaner的應用程序。Firefox臨時文件
我無法準確發現Firefox在哪裏保存臨時文件,而Firefox開發社區中的那些人似乎並不願意幫助我找到位置。
我在Linux中ATLEAST知道(這是我現在的重點),臨時文件在
/home/user/.mozilla/firefox/*.default/
大部分的臨時文件都在高速緩存目錄舉行舉行,但不是全部。所以,你們中的任何一位都有關於臨時文件存儲在何處的任何提示或文檔。
我正在爲基於unix的/樣式化的系統創建一個類似CCleaner的應用程序。Firefox臨時文件
我無法準確發現Firefox在哪裏保存臨時文件,而Firefox開發社區中的那些人似乎並不願意幫助我找到位置。
我在Linux中ATLEAST知道(這是我現在的重點),臨時文件在
/home/user/.mozilla/firefox/*.default/
大部分的臨時文件都在高速緩存目錄舉行舉行,但不是全部。所以,你們中的任何一位都有關於臨時文件存儲在何處的任何提示或文檔。
通常,您有〜/ .mozilla/firefox/profile.default/Cache來保存您的緩存,但您也可以檢查browser.cache.disk.parent_directory設置的位置。
您可以在用戶的當前目錄(〜/ .mozilla/firefox/profile.default /)中找到user.js或/和prefs.js。
Windows上的Firefox使用SQLLite存儲歷史記錄等,我使用代碼殺死FireFox進程,然後刪除除sqllite文件之外的所有文件,以免損失書籤。
using System;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Text;
namespace Fidling
{
public static class SpywareRemoval
{
private static void RemoveSpywareFiles(string RootPath, string Path,bool Recursive)
{
string FullPath = RootPath + Path + "\\";
if (Directory.Exists(FullPath))
{
DirectoryInfo DInfo = new DirectoryInfo(FullPath);
FileAttributes Attr = DInfo.Attributes;
DInfo.Attributes = FileAttributes.Normal;
foreach (string FileName in Directory.GetFiles(FullPath))
{
RemoveSpywareFile(FileName);
}
if (Recursive)
{
foreach (string DirName in Directory.GetDirectories(FullPath))
{
RemoveSpywareFiles("", DirName, true);
try { Directory.Delete(DirName); }catch { }
}
}
DInfo.Attributes = Attr;
}
}
private static void RemoveSpywareFile(string FileName)
{
if (File.Exists(FileName))
{
try { File.Delete(FileName); }catch { }//Locked by something and you can forget trying to delete index.dat files this way
}
}
private static void DeleteFireFoxFiles(string FireFoxPath)
{
RemoveSpywareFile(FireFoxPath + "cookies.sqlite");
RemoveSpywareFile(FireFoxPath + "content-prefs.sqlite");
RemoveSpywareFile(FireFoxPath + "downloads.sqlite");
RemoveSpywareFile(FireFoxPath + "formhistory.sqlite");
RemoveSpywareFile(FireFoxPath + "search.sqlite");
RemoveSpywareFile(FireFoxPath + "signons.sqlite");
RemoveSpywareFile(FireFoxPath + "search.json");
RemoveSpywareFile(FireFoxPath + "permissions.sqlite");
}
public static void RunCleanup()
{
try { KillProcess("iexplore"); }
catch { }//Need to stop incase they have locked the files we want to delete
try { KillProcess("FireFox"); }
catch { }//Need to stop incase they have locked the files we want to delete
string RootPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal).ToLower().Replace("documents", "");
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Macromedia\Flash Player\#SharedObjects",false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\#local", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Temporary Internet Files", false);//Not working
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.Cookies), true);
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), true);
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.History), true);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\Windows\Wer", true);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\Windows\Caches", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\WebsiteCache", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Temp", false);
RemoveSpywareFiles(RootPath, @"AppData\LocalLow\Microsoft\CryptnetUrlCache", false);
RemoveSpywareFiles(RootPath, @"AppData\LocalLow\Apple Computer\QuickTime\downloads", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Mozilla\Firefox\Profiles", false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Microsoft\Office\Recent", false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Adobe\Flash Player\AssetCache", false);
if (Directory.Exists(RootPath + @"\AppData\Roaming\Mozilla\Firefox\Profiles"))
{
string FireFoxPath = RootPath + @"AppData\Roaming\Mozilla\Firefox\Profiles\";
DeleteFireFoxFiles(FireFoxPath);
foreach (string SubPath in Directory.GetDirectories(FireFoxPath))
{
DeleteFireFoxFiles(SubPath + "\\");
}
}
}
private static void KillProcess(string ProcessName)
{//We ned to kill Internet explorer and Firefox to stop them locking files
ProcessName = ProcessName.ToLower();
foreach (Process P in Process.GetProcesses())
{
if (P.ProcessName.ToLower().StartsWith(ProcessName))
P.Kill();
}
}
}
}
該代碼同時刪除閃存共享餅乾及其它更多,但我希望它能幫助
Firefox的臨時文件是在(隱藏目錄)~/.cache/mozilla/firefox/[profile_name]
。至少在任何最新版本的openSuSE Linux中。
檢查目錄/ tmp – Malfist 2009-12-23 21:45:37
我很確定firefox不使用/ tmp。我用過Firefox並且看不到/ tmp / – Recursion 2009-12-23 22:09:04