Delete Firefox History and Favicon via do shell script

Hello,

I want delete the Firefox history and Firefox favicons individually…

For History with the Terminal:
cd ~/Library/‘Application Support’/Firefox/Profiles/*.default
sqlite3 places.sqlite
delete from moz_historyvisits;
.quit

For Favicons with the Terminal:
cd ~/Library/‘Application Support’/Firefox/Profiles/*.default
sqlite3 places.sqlite
delete from moz_favicons;
.quit

How make that with do shell script?

Thanks for your help!
… Sorry for my bad english.

:wink:

I didn’t try this but if your sqlite commands are correct this should work. Basically you can run sqlite3 commands using ‘do shell script’.

set firefoxBase to (path to application support folder from user domain as text) & "Firefox:Profiles:"

-- get the default user folder
tell application "Finder" to set foldernames to name of folders of folder firefoxBase
repeat with i from 1 to count of foldernames
	if (item i of foldernames) contains ".default" then
		set defaultFolderName to (item i of foldernames)
		exit repeat
	end if
end repeat
set defaultFolderPath to firefoxBase & defaultFolderName & ":"

-- run the commands
set sqliteDBPath to defaultFolderPath & "places.sqlite"
do shell script "sqlite3 " & quoted form of POSIX path of sqliteDBPath & " \"delete from moz_historyvisits;\""
do shell script "sqlite3 " & quoted form of POSIX path of sqliteDBPath & " \"delete from moz_favicons;\""

Thanks regulus6633.

More short… I even answer myself me. :rolleyes:

For favicons:

do shell script "sqlite3 ~/Library/'Application Support'/Firefox/Profiles/*.default/places.sqlite 'delete from moz_favicons;'"

For History:

do shell script "sqlite3 ~/Library/'Application Support'/Firefox/Profiles/*.default/places.sqlite 'delete from moz_historyvisits;'"

:wink: