I need to find out what file formats is in my external backup drive.
So basically the result list looks like this: {jpg, txt, html, …}
I need to find out what file formats is in my external backup drive.
So basically the result list looks like this: {jpg, txt, html, …}
Hi,
short but slow
property extensionList : {}
set baseFolder to choose folder
processFolder(baseFolder)
on processFolder(folderReference)
tell application "Finder"
set itemList to items of folderReference
repeat with anItem in itemList
if class of anItem is folder then
my processFolder(anItem)
else
set nameExtension to name extension of anItem
if nameExtension is not in extensionList then
set end of extensionList to nameExtension
end if
end if
end repeat
end tell
end processFolder
This may be faster than StefanK’s script. I didn’t test it though. I did run it on my application’s folder and it’s pretty fast.
set baseFolder to choose folder
tell application "Finder"
set nameExtensions to name extension of entire contents of baseFolder
end tell
set nameExtensionsRef to a reference to nameExtensions
set uniqueExtensions to {}
repeat with i from 1 to count of nameExtensionsRef
set thisOne to item i of nameExtensionsRef
if thisOne is not in uniqueExtensions then
set end of uniqueExtensions to thisOne
end if
end repeat
return uniqueExtensions
For lazy users, here what was reported on my Lion system.
{“”, “py”, “pl”, “pages”, “dmg”, “app”, “zip”, “txt”, “pdf”, “jpg”, “png”, “scpt”, “pkg”, “rtfd”, “html”, “webloc”, “rtf”, “plist”, “cwk”, “spx”, “tiff”, “gz”, “numbers”, “sit”, “applescript”, “sxw”, “xls”, “hqx”, “doc”, “sparseimage”, “gif”, “psd”, “bz2”, “tbz”, “tar”, “mpkg”, “m3u”, “qlgenerator”, “rar”, “bin”, “flv”, “fp7”, “nmbtemplate”, “eml”, “csv”, “xml”, “text”, “jpeg”, “webarchive”, “action”, “caction”, “definition”, “plugin”, “dictionary”, “lpdf”, “ttc”, “ttf”, “dfont”, “otf”, “framework”, “webplugin”, “bundle”, “keychain”, “log”, “ccl”, “regs”, “workflow”, “prefPane”, “component”, “sh”, “osax”, “service”, “crt”, “mdimporter”, “wdgt”, “ini”, “js”, “xsl”, “dot”, “conf”, “d”, “cshrc”, “dylib”, “rb”, “fmplugin”, “dat”, “css”, “xcodeproj”, “m”, “icns”, “strings”, “tracetemplate”, “docset”, “h”, “scriptSuite”, “sdef”, “nib”, “scriptTerminology”, “r”, “bom”, “make”, “template”, “htm”, “ofx”, “textClipping”, “dict”, “mov”, “mpg”, “epub”, “iso”, “docx”, “bentoTemplate”, “xla”, “jar”, “mp3”, “smi”, “img”, “sea”, “NEF”, “tif”, “xcf”, “dvdproj”, “hpi”, “exe”, “sparsebundle”, “eps”, “cws”, “001”, “002”, “xlsx”, “shlb”, “icc”, “help”, “scr”, “suit”, “bmap”, “pm”, “colorPicker”, “clr”, “qtz”, “dtd”, “kext”, “ppp”, “fs”, “loginPlugin”, “monitorPanel”, “slideSaver”, “saver”, “aiff”, “dic”, “spreporter”, “key”, “ott”, “ots”, “oxt”, “ics”, “ods”, “idatabase”, “O”, “term”, “data”, “out”, “mom”, “exp”, “sql”, “hdr”, “pro”, “info”, “sample”, “pdb”, “tab”, “sqlite”, “box1”, “jp2”, “upr”, “mpr”, “flb”, “xnf”, “cpp”, “pbplugin”, “xcplugin”, “xcodeplugin”, “xdplugin”, “xcconfig”, “c”, “sub”, “tex”, “cc”, “crash”, “wav”, “swf”, “ppt”, “Logo”, “mac”, “sitx”, “PCT”, “PICT”, “005”, “mwand”, “icm”, “ilmbplugin”, “m4a”, “mrbEffect”, “mrbFilter”, “mrbFrame”, “mrbStyle”, “mrbTransition”, “menu”, “dsclext”, “jdk”, “tcl”, “pch”, “ico”, “download”, “iw4ext”, “vlc”, “Terminal”, “Xcode”, “iPhoto”, “Bean”, “Acorn”, “skitch”, “skim”, “X11”, “adr”, “rcproject”, “itl”, “iw4”, “xpm”, “xsd”, “ldif”, “pem”, “php”, “ps”, “defs”, “el”, “pfa”, “diff”, “rng”, “class”, “java”, “theme”, “au”, “dist”, “a”, “am”, “patch”, “GS”, “FP”, “s”, “CRW”, “dotx”, “potx”, “thmx”, “rez”, “cer”, “band”, “scptd”, “caf”, “svg”, “utf8”, “xbm”, “bmp”, “rdf”, “4DC”, “4dlink”, “kml”, “xspf”, “DLL”, “json”, “ipa”, “7z”, “pyc”, “pyo”, “pfb”, “binary”, “yml”, “it”, “bash”, “csh”, “icon”, “pbm”, “war”, “mo”, “spl”, “tsv”, “pbxuser”, “pbxproj”, “inc”, “bib”, “fpx”, “pgm”, “ppm”, “aif”, “rmf”, “mid”, “xib”, “cp”, “ibplugin”, “B”, “F”, “G”, “I”, “J”, “QXD”, “Setup”, “stack”, “ADB”, “IM”, “MM”, “HP”, “L”, “RM”, “p”, “sr”, “asm”, “TS”, “fax”, “equ”, “gcx”, “svgz”, “manifest”, “idx”, “ldi”, “dd”, “latex”, “abcdp”, “abcdg”, “4dd”, “Match”, “growlTicket”, “mbp”, “mobi”, “sbxplugin”, “mbox”, “mab”, “m4v”, “dds”, “PLT”, “lua”, “pat”, “sgml”, “gem”, “erb”, “xslt”, “jnlp”, “xcdatamodel”, “command”, “dcplugin”, “Mars”, “indd”, “buf”, “LM”, “WM”, “Tim”, “Arc”, “II”, “XM”, “Pics”, “SCG”, “Rev”, “MI”, “PIC”, “GAME”, “vcf”, “frag”, “vert”, “gzip”, “chat”, “4DIndy”, “url”, “kth”, “caminobookmark”, “webbookmark”, “webhistory”, “gih”, “tga”, “avi”, “markdown”, “clix”, “Set”, “Pas”, “048”, “ACE”, “MIDI”, “mod”, “SND”, “PIX”, “acrodata”, “del”, “4ie”, “xlc”, “odb”, “sdv”, “rhtml”, “hpp”, “pyw”, “uue”, “tool”, “dbf”, “yaml”, “xcdatamodeld”, “acm”, “xhtml”, “emlx”, “fsh”, “vsh”, “MD”, “mailstationery”, “dae”, “y”, “fits”, “f90”, “p7s”, “ai”, “mp4”, “as”, “sdp”, “dif”, “wmv”, “pps”, “msp”, “uu”}
Yvan KOENIG (VALLAURIS, France) samedi 24 décembre 2011 20:57:00
Yvan, The difference between actual files on the hard drive and supported files are quite different. To get every supported/know file format you can use launch services database to get the most recent known files.
To get every file extension from an external hard drive you need stefan’s approach. I think it would be faster with a shell script but you need to resolve every directory and check for it files names in the directory (file names are connected with file nodes in directory files).
What I posted is what was returned by Stephan’s script.
I’m not sure that the contents of LaunchService database would be complete.
I have a lot of files in my system which were never called because they belong to features which I never use.
Yvan KOENIG (VALLAURIS, France) lundi 26 décembre 2011 18:19:23