--Applescript direct -- CUSTOMISE TO YOUR LIKING: property extensions_to_delete : {"acn", "acr", "alg", "aux", "bak", "blg", "brf", "dep", "dvi", "ent", "fdb_latexmk", "glg", "gls", "fff", "glo", "idv", "idx", "ilg", "ind", "ist", "lg", "loa", "lof", "log", "lot", "mtc", "mlf", "nav", "out", "pdfsync", "ps", "snm", "synctex", "toc", "tmp", "ttt", "tui", "tuo", "wrm", "xref", "4ct", "4tc"} property delete_files_only_with_same_name : true -- If your file is document.tex, setting this true will delete only document.aux, document.log, etc., but NOT otherdoc.aux, otherdoc.log, etc. -- Otherwise, ALL files with the extensions_to_delete will be deleted. -- Clean Up By Will Robertson 8/17/2004 -- Fixed For Leopard By Dick Koch 12/11/2007 -- THE SCRIPT: tell application "TeXShop" set texpath to alias POSIX file #TEXPATH# -- gives "/path/to/docu.tex" tell application "Finder" set texfolder to the container of (texpath as alias) if delete_files_only_with_same_name then set texname to the name of (texpath as alias) set texname to do shell script "echo " & the quoted form of texname & " | cut -f 1 -d '.' " set texfiles to every file in texfolder whose name contains (texname & ".") else set texfiles to every file in texfolder end if end tell set files_to_delete to {} set filenames_to_delete to {} repeat with this_file in texfiles set actualname to the name of this_file set actualextension to do shell script "echo " & the quoted form of actualname & " | cut -f 2 -d '.'" -- if (the name extension of this_file is in extensions_to_delete) then if (actualextension is in extensions_to_delete) then set the end of files_to_delete to (this_file) set the end of filenames_to_delete to " Ê Ê" & (the name of this_file as string) & return end if end repeat display dialog "Are you sure you want to move the following files to the trash?" & return & filenames_to_delete as string buttons {"Keep", "Trash"} default button "Trash" with icon caution if the button returned of the result is "Trash" then tell application "Finder" to move every item of files_to_delete to the trash end if end tell