Ich würde es lieben, wenn ich den Finder irgendwie dazu bringen könnte, alle Ordner mit einem .git-Verzeichnis farblich zu kennzeichnen, damit ich auf einen Blick erkennen könnte, ob es sich bei dem Ordner um ein Git-Repo handelt. Irgendwelche Ideen?
Ich habe diese Frage gesehen und festgestellt, dass die Antwort auch für mich nützlich wäre. Hier ist das Applescript, das ich mir ausgedacht habe. Kopieren Sie es in den Applescript-Editor und passen Sie die beiden Variablen theSearchPath
(erste Zeile) und die Indexnummer am Ende der set label index
Zeile an, und Sie sollten loslegen können.
Ich suche ~/projects
und färbe die Ergebnisse in diesem Fall grün.
set theSearchPath to "/Users/Me/projects"
set theResults to do shell script "find " & quoted form of theSearchPath & " -name .git"
repeat with i from 1 to (count paragraphs of theResults)
set theResult to paragraph i of theResults
set theParentPath to text 1 through ((length of theResult) - 5) of theResult
set theParentAlias to POSIX file (theParentPath) as alias
tell application "Finder"
set label index of theParentAlias to 6
-- Set the last value of the above line to correspond with the color you want.
-- 0 is no color
-- 1 is orange
-- 2 is red
-- 3 is yellow
-- 4 is blue
-- 5 is purple
-- 6 is green
-- 7 is gray
end tell
end repeat
Hinweis: Es wurde nicht geschrieben, um Fehler, die vom find
Befehl ausgegeben werden, ordnungsgemäß zu behandeln. Solange Sie Verzeichnisse durchsuchen, für die Sie Berechtigungen haben, sollte dies kein Problem darstellen.
Das Skript von Vickash hat bei mir nicht funktioniert, also habe ich es aktualisiert und leicht überarbeitet, um jede Dateierweiterung finden zu können, indem ich die Erweiterung in der Variablen (in meinem Fall .flac-Dateien) angibt. theFileExtension
Funktioniert in Sierra.
set theSearchPath to "/Users/Me/projects"
set theFileExtension to ".flac"
set theResults to do shell script "find " & quoted form of theSearchPath & " -name *"&theFileExtension
repeat with i from 1 to (count paragraphs of theResults)
set theResult to paragraph i of theResults
set thePath to text 1 through ((length of theResult)) of theResult
tell application "Finder"
set theParentAlias to container of (POSIX file (thePath) as alias)
set label index of theParentAlias to 1
-- Set the last value of the above line to correspond with the color you want.
-- 0 is no color
-- 1 is orange
-- 2 is red
-- 3 is yellow
-- 4 is blue
-- 5 is purple
-- 6 is green
-- 7 is gray
end tell
end repeat
Benutzer588
Bernk
Benutzer588
Benutzer588