Überordner mit gleichem Namen erstellen

Swabke

Aktives Mitglied
Thread Starter
Dabei seit
04.06.2012
Beiträge
106
Reaktionspunkte
1
Hi Zusammen

Ich habe jetzt lange im internet gesucht und auch selbst ausprobiert, bin aber zu keiner Lösung gekommen:

Ich versuche einen Automator Dienst zu erstellen, die für eine Datei einen gleichnamigen ordnet erstellt und diese dann darein BEWEGT.
bsp:
Ausgangslage: Ich habe ein Film namens testfilm123.mov
Ziel: Ich habe einen Ordner namens testfilm123 und darin ist der Film testfilm123.mov

die Aktion soll auch mehrere filme gleichzeitig empfangen können.

Danke für die Hilfe

Gruss
Swabke
 
Hallo,
danach habe ich auch gesucht und bin dann auf dieses Apple Script gestoßen:

set the_folder to choose folder


tell application "Finder"
set the_list to files of the_folder
repeat with i in the_list
try
set theName to name of i
set extLength to length of ((name extension of i) as text)
set n to text 1 thru ((length of theName) - extLength - 1) of theName
set nf to make new folder at the_folder with properties {name:n}
move i to nf

end try
end repeat
end tell


Grüße,
Sascha
 
Danke schon mal, klappt super

Ich würde es allerdings am liebsten in einen Automator Dienst einbauen (weil ich damit noch andere Dinge machen möchte). Wenn ich allerdings das Skript in "Applescript ausführen" rein kopiere, dann klappt es nicht und ich weiss nicht wie ich es verändern muss.

Was ich unter anderem schon versucht habe:

on run {input, parameters}

set the_folder to input


tell application "Finder"
set the_list to files of the_folder
repeat with i in the_list
try
set theName to name of i
set extLength to length of ((name extension of i) as text)
set n to text 1 thru ((length of theName) - extLength - 1) of theName
set nf to make new folder at the_folder with properties {name:n}
move i to nf

end try
end repeat
end tell

return input
end run

Beim ausführen passiert dann aber nichts :(
 
Hallo,

so oder so ähnlich sollte es im Automator funktionieren:

Code:
[COLOR=#000000][FONT=Verdana][B]on[/B] [/FONT][/COLOR][COLOR=#0433FF][FONT=Verdana][B]run[/B][/FONT][/COLOR][COLOR=#000000][FONT=Verdana] {[/FONT][/COLOR][COLOR=#4F8F00][FONT=Verdana]input[/FONT][/COLOR][COLOR=#000000][FONT=Verdana], [/FONT][/COLOR][COLOR=#4F8F00][FONT=Verdana]parameters[/FONT][/COLOR][COLOR=#000000][FONT=Verdana]}
[/FONT][/COLOR][FONT=Verdana]    [B]tell[/B] [COLOR=#0433ff][I]application[/I][/COLOR] "Finder"[/FONT]
[FONT=Verdana]        [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]i[/COLOR] [B]in[/B] [COLOR=#4f8f00]input[/COLOR][/FONT]
[FONT=Verdana]            [B]try[/B][/FONT]
[FONT=Verdana]                [B]set[/B] [COLOR=#4f8f00]theName[/COLOR] [B]to[/B] [COLOR=#812fdc]name[/COLOR] [B]of[/B] [COLOR=#4f8f00]i[/COLOR][/FONT]
[FONT=Verdana]                [B]set[/B] [COLOR=#4f8f00]extLength[/COLOR] [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] (([COLOR=#812fdc]name extension[/COLOR] [B]of[/B] [COLOR=#4f8f00]i[/COLOR]) [B]as[/B] [COLOR=#0433ff][I]text[/I][/COLOR])[/FONT]
[FONT=Verdana]                [B]set[/B] [COLOR=#4f8f00]n[/COLOR] [B]to[/B] [COLOR=#0433ff][I]text[/I][/COLOR] 1 [B]thru[/B] (([COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]theName[/COLOR]) - [COLOR=#4f8f00]extLength[/COLOR] - 1) [B]of[/B] [COLOR=#4f8f00]theName[/COLOR][/FONT]
[COLOR=#0433FF][FONT=Verdana][COLOR=#000000]                [B]set[/B] [/COLOR][COLOR=#4f8f00]nf[/COLOR][COLOR=#000000] [B]to[/B] [/COLOR][B]make [/B]new [I]folder [/I]at [COLOR=#4f8f00]the_folder [/COLOR]with properties[COLOR=#000000] {[/COLOR][COLOR=#812fdc]name[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#4f8f00]n[/COLOR][COLOR=#000000]}[/COLOR][/FONT][/COLOR]
[FONT=Verdana]                [COLOR=#0433ff][B]move[/B][/COLOR] [COLOR=#4f8f00]i[/COLOR] [COLOR=#0433ff]to[/COLOR] [COLOR=#4f8f00]nf[/COLOR][/FONT]

[FONT=Verdana]            [B]end[/B] [B]try[/B][/FONT]
[FONT=Verdana]        [B]end[/B] [B]repeat[/B][/FONT]
[FONT=Verdana]    [B]end[/B] [B]tell[/B][/FONT]
[FONT=Verdana]    [B]return[/B] [COLOR=#4f8f00]input[/COLOR][/FONT]
[B]end [/B][COLOR=#0433FF][FONT=Verdana][B]run[/B][/FONT][/COLOR]
 
passiert immer noch nichts.
Ich habe die Vermutung dass das script so nur den Ordner empfängt und nicht die einzelnen Dateien darin (welche es ja in einzelne Ordner tun soll). Und da der Ordner ja schon ein Ordner ist passiert einfach nichts.
 
und wenn du the_folder mit input ersetzt?
 
Jetzt macht es was ganz komisches: :)
Wenn ich als input ein Ordner mit dem Namen "test" habe, dann macht es mir in dem Ordner selbst ein Leerer Ordner namens "tes". Denn eigentlichen Inhalt lässt es unberührt.
 
Zurück
Oben Unten