Zeige nur "Invisibles"

Atalantia

Atalantia

Aktives Mitglied
Thread Starter
Dabei seit
26.11.2009
Beiträge
1.894
Reaktionspunkte
432
Ich versuche ein Skript zu basteln, dass nur die unsichtbaren Dateien eines Verzeichnisses zeigt.
Ich versuchte:
Code:
set fileList to entire content of (choose folder)
repeat with fileList in fileList
set invList to fileList is not visible
Dispaly dialog invList

Ist das einzige was mir in den Sinn gekommen ist, funktioniert aber nicht. Gibt's ein Skript für diese Anforderung?
 
Dazu muss Dir klar sein, dass unterschiedliche Arten von Unsichtbar gibt.
Es gibt Systemdateien, die mit einem Punkt beginnen, welche die eine entsprechende Markierung haben etc.

Viele Grüße

Code:
--

on hiddenItemSubpathsOfDirectory(theDirectoryPath)
	
	--
	
	if (length of theDirectoryPath < 1) then
		
		return {}
		
	end if
	
	--
	
	tell application "Finder"
		
		--
		
		try
			
			--
			
			set allItems to list folder of (theDirectoryPath as POSIX file)
			
			--
			
		on error the errorMessage number the errorNumber
			
			--
			
			return {}
			
			--
			
		end try
		
	end tell
	
	--
	
	if ((count of allItems) < 1) then
		
		return {}
		
	end if
	
	--
	
	set allPaths to {}
	
	--
	
	repeat with nItem in allItems
		
		--
		
		set aItem to theDirectoryPath & nItem
		
		--
		
		tell application "System Events"
			
			--
			
			if (visible of disk item aItem is false) then
				
				copy aItem to end of allPaths
				
			end if
			
			--
			
		end tell
		
		--
		
	end repeat
	
	--
	
	return allPaths
	
	--
	
end hiddenItemSubpathsOfDirectory

--
 
  • Gefällt mir
Reaktionen: Atalantia
Alternativ via Shellscript:

Code:
[COLOR=#000000][FONT=Verdana][B]set[/B] [/FONT][/COLOR][COLOR=#4F8F00][FONT=Verdana]theFolder[/FONT][/COLOR][COLOR=#000000][FONT=Verdana] [B]to[/B] [/FONT][/COLOR][B]choose folder
[/B][FONT=Verdana][B]set[/B] [COLOR=#4f8f00]hiddenFiles[/COLOR] [B]to[/B] ([COLOR=#012fbe][B]do shell script[/B][/COLOR] "ls -laO " & [COLOR=#812fdc]quoted form[/COLOR] [B]of[/B] [COLOR=#812fdc]POSIX path[/COLOR] [B]of[/B] [COLOR=#4f8f00]theFolder[/COLOR] & "| awk '$5 ~/hidden/ || $10 ~/^\\..*[^.]$/ {print $10}'")[/FONT]
[B]display dialog [/B][COLOR=#4F8F00][FONT=Verdana]hiddenFiles[/FONT][/COLOR]
 
  • Gefällt mir
Reaktionen: Atalantia
Zurück
Oben Unten