• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Viele hassen ihn, manche schwören auf ihn, wir aber möchten unbedingt sehen, welche Bilder Ihr vor Eurem geistigen Auge bzw. vor der Linse Eures iPhone oder iPad sehen könnt, wenn Ihr dieses Wort hört oder lest. Macht mit und beteiligt Euch an unserem Frühjahrsputz ---> Klick

Dateien vergleichen, umbenennen, kopieren, etc

goeste

Jonagold
Registriert
04.04.07
Beiträge
23
Hallöchen an alle,

Ich habe ein Problem beim Vergleichen von 2 Ordnern. Mit dem Automator kenne ich mich schon ziehmich gut aus, aber hier stoße ich an meine Grenzen.

Folgende Situation:

Ich habe 2 Ordner. In beiden Ordnern sind Dateien vorhanden, die durchnummerriert sind (001-100). Nun möchte ich beide Ordner vergleichen. Die Dateien in Ordner 1 und Ordner 2 sind meistens identisch, jedoch unterscheiden sich die Nummern die vorwegstehen (sprich die Reihenfolge ändert sich immer). Die Dateien aus Ordner 1 die sich nicht in Ordner 2 befinden sollen VOR der Vorhergehenden Nummer ein 'OUT+Datum' (das Datum im Format YYYYMMDD) bekommen und anschliessend in Ordner 2 kopiert werden. Die Dateien von Ordner 2 sollen nicht geändert werden.

Es wäre toll, wenn mir hierbei jemand zu Seite stehen könnte und einen oder zwei Tipps geben könnte, wie man dieses Problem lösen könnte ;)

Vielen Dank schonmal an alle die meinen Beitrag gelesenhaben und einen hilfreichen Post hinterlassen ;)

Wenn Ir noch Infos braucht, zögert nicht zu fragen :)
 

RedCloud

deaktivierter Benutzer
Registriert
02.06.08
Beiträge
6.036
Evtl. manuell mit dem muCommander abgleichen? o_O
 

goeste

Jonagold
Registriert
04.04.07
Beiträge
23
das war aber fix.... wow...

nunja, der muCommander sieht ja ganz nett aus, aber ich wollte eigentlich, dass dass alles automatisch von statten gegeht, sozusagen unbeaufsichtig. Und ohne sich erst in ein neues Programm einzuarbeiten.
 

RedCloud

deaktivierter Benutzer
Registriert
02.06.08
Beiträge
6.036
das war aber fix.... wow...

nunja, der muCommander sieht ja ganz nett aus, aber ich wollte eigentlich, dass dass alles automatisch von statten gegeht, sozusagen unbeaufsichtig. Und ohne sich erst in ein neues Programm einzuarbeiten.

Einarbeiten ist m.E. beim muCommander nicht erforderlich
- und ich möchte selbst entscheiden was wichtig ist, bzw. was gelöscht werden kann. ;)
 

goeste

Jonagold
Registriert
04.04.07
Beiträge
23
und ich möchte selbst entscheiden was wichtig ist, bzw. was gelöscht werden kann. ;)

Das kann ich bei einigen wenigen Dateien verstehen. Aber wie gesagt ich suche ein script (vollständig) oder ein script, das den automator dabei unterstützt die für mich zu machen ;)
 
Zuletzt bearbeitet:

hubionmac

Tydemans Early Worcester
Registriert
25.06.04
Beiträge
393
Sodele, die Idee hat mich einfach nicht mehr losgelassen... wenngleich ich das Skript selber nicht gebrauchen kann... Bin halt ein selbstloser Typ mit Schlafstörung :-D


Installation:

  1. Wenn Du es das erste mal startest, erzeugt es einen Ordner mit dem Namen "SyncFolders_Script_aliases" auf deinem Start-Volumen und öffnet diesen.
  2. In diesen Ordner ziehst Du zunächst Aliase der Quell-Ordner (ja Du kannst mehrere Ordner in einen Zielordner synchronisieren).
  3. Diese Ordner-Alias bennenst Du um in SOURCE.. irgendwas, wichtig ist nur, dass SOURCE am Anfang steht
  4. Dann erstellst Du da noch einen Alias deines Zielordners, den Du DESTINATION irgendwas nennst

Dann nur noch starten und das Skript legt los =)


Wie es funktioniert?:
Die Dateien werden an Hand von md5 Prüfsummen unterschieden. Jede Dateien, deren md5-Prüfsumme mit denen der Dateien im Zielordner nicht übereinstimmt, wird umbenannt, nach dem Schema, dass Du wolltest und dann kopiert. Sollte es beim Kopieren zu Problemen kommen, wird die Datei wieder "zurück-benannt" und das Skript läuft weiter. Am Ende erscheint in dem Fall aber eine Fehlermeldung.
In dem Skript Ordner wird zudem ein Datei log.txt geführt, in der dann bei jedem Start geschrieben wird, wie viel wohin kopiert wurde und ob es Fehler gegeben hat...

Gut und jetzt der Code:
Code:
[SIZE=1]-- 
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]script_folder[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] "SyncFolders_Script_aliases"
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]copycount[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] 0
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]copiedpaths[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] ""
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]errorpaths[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] ""
[COLOR=#3f7f00]checkup[/COLOR]([COLOR=#3f7f00]script_folder[/COLOR])

[COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder"
   
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]folder[/COLOR] [COLOR=#3f7f00]script_folder[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#0000ff]startup disk[/COLOR]
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]source_aliases[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] ([COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]alias file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]whose[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]starts with[/B][/COLOR] "SOURCE")
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]destination_alias[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] ([COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]alias file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]whose[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]starts with[/B][/COLOR] "DESTINATION")
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]tell[/B][/COLOR]
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]destination_files[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]md5_list[/COLOR]([COLOR=#0000ff]item[/COLOR] 1 [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]destination_alias[/COLOR])
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]source_files[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] {}
[COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]i[/COLOR] [COLOR=#2900ff][B]from[/B][/COLOR] 1 [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]count[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]source_aliases[/COLOR]
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]source_files[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]source_files[/COLOR] & [COLOR=#3f7f00]md5_list[/COLOR]([COLOR=#0000ff]item[/COLOR] [COLOR=#3f7f00]i[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]source_aliases[/COLOR])
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]

--[COLOR=#4c4d4d] assume that all sources are new sources[/COLOR]
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]newsources[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]source_files[/COLOR]

[COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]destination_file[/COLOR] [COLOR=#2900ff][B]in[/B][/COLOR] [COLOR=#3f7f00]destination_files[/COLOR]
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]b[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]md5[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]destination_file[/COLOR]
   [COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]source_file[/COLOR] [COLOR=#2900ff][B]in[/B][/COLOR] [COLOR=#3f7f00]source_files[/COLOR]
      [COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#3f7f00]md5[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]source_file[/COLOR] = [COLOR=#3f7f00]b[/COLOR] [COLOR=#2900ff][B]then[/B][/COLOR]
         
         --[COLOR=#4c4d4d]finally only new sources will stay in the newsources list [/COLOR]
         [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]newsources[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]delete_from_list[/COLOR]([COLOR=#3f7f00]source_file[/COLOR], [COLOR=#3f7f00]newsources[/COLOR])
      [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]erroronmove[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]false[/COLOR]
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]prestring[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] "OUT+" & ([COLOR=#0000ff]do shell script[/COLOR] "date +%Y%m%d")
[COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]newsource[/COLOR] [COLOR=#2900ff][B]in[/B][/COLOR] [COLOR=#3f7f00]newsources[/COLOR]
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]current_file[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]MacOSPath[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]newsource[/COLOR]
   [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder" [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]current_file_name[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] ([COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]current_file[/COLOR])
   
   --[COLOR=#4c4d4d]If the would be files already named "OUT+..:" that are NOT in the destination path [/COLOR]
   --[COLOR=#4c4d4d]these would no be copied [/COLOR]
   --[COLOR=#4c4d4d]if current_file_name does not start with "OUT+" then[/COLOR]
   
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]current_file[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]rename_file[/COLOR]([COLOR=#3f7f00]current_file[/COLOR], [COLOR=#3f7f00]prestring[/COLOR], [COLOR=#3f7f00]current_file_name[/COLOR])
   [COLOR=#2900ff][B]try[/B][/COLOR]
      [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder"
         
         [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]copiedfile[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]duplicate[/COLOR] [COLOR=#3f7f00]current_file[/COLOR] [COLOR=#0000ff]to[/COLOR] ([COLOR=#0000ff]original item[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#0000ff]item[/COLOR] 1 [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]destination_alias[/COLOR])) [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR]
         [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]copycount[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]copycount[/COLOR] + 1
         [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]copiedpaths[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]copiedpaths[/COLOR] & ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]copiedfile[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR]) [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]text[/COLOR]) & [COLOR=#0000ff]return[/COLOR]
      [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]tell[/B][/COLOR]
   [COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#2900ff][B]error[/B][/COLOR] [COLOR=#3f7f00]msg[/COLOR]
      [COLOR=#3f7f00]rename_file[/COLOR]([COLOR=#3f7f00]current_file[/COLOR], "", [COLOR=#3f7f00]current_file_name[/COLOR])
      [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]errorpaths[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]errorpaths[/COLOR] & ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]current_file[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR]) [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]text[/COLOR]) & [COLOR=#0000ff]return[/COLOR]
      
      [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]erroronmove[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]true[/COLOR]
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]try[/B][/COLOR]
   
   --[COLOR=#4c4d4d]end if[/COLOR]
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]


--[COLOR=#4c4d4d]write Logfiles[/COLOR]
[COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]msg[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] "Copied " & [COLOR=#3f7f00]copycount[/COLOR] & " files at "
[COLOR=#0000ff]do shell script[/COLOR] "echo " & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]msg[/COLOR] & "|cat>>" & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])) & "log.txt"
[COLOR=#0000ff]do shell script[/COLOR] "date | cat>>" & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])) & "log.txt"
[COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#3f7f00]copiedpaths[/COLOR] ≠ "" [COLOR=#2900ff][B]then[/B][/COLOR]
   [COLOR=#0000ff]do shell script[/COLOR] "echo " & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]copiedpaths[/COLOR] & "|cat>>" & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])) & "log.txt"
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
[COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#3f7f00]erroronmove[/COLOR] = [COLOR=#0000ff]true[/COLOR] [COLOR=#2900ff][B]then[/B][/COLOR]
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]msg[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] "Errors with files: "
   [COLOR=#0000ff]do shell script[/COLOR] "echo " & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]msg[/COLOR] & "|cat>>" & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])) & "log.txt"
   [COLOR=#0000ff]do shell script[/COLOR] "echo " & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]errorpaths[/COLOR] & "|cat>>" & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])) & "log.txt"
   
   [COLOR=#0000ff]display dialog[/COLOR] "Some files could not be copied (name already exsist perhaps) and so presstring has been removed from there names again (just in case the prestring is :" & [COLOR=#0000ff]return[/COLOR] & [COLOR=#3f7f00]prestring[/COLOR] [COLOR=#0000ff]giving up after[/COLOR] 10
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]


[COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#3f7f00]rename_file[/COLOR]([COLOR=#3f7f00]thefile[/COLOR], [COLOR=#3f7f00]new_start[/COLOR], [COLOR=#3f7f00]thefile_name[/COLOR])
   [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder"
      [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]no_error[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]false[/COLOR]
      [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]counter[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] 0
      [COLOR=#2900ff][B]try[/B][/COLOR]
         
         [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]new_start[/COLOR] & [COLOR=#3f7f00]thefile_name[/COLOR]
      [COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#2900ff][B]error[/B][/COLOR]
         [COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]until[/B][/COLOR] [COLOR=#3f7f00]no_error[/COLOR] = [COLOR=#0000ff]true[/COLOR]
            [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]counter[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]counter[/COLOR] + 1
            [COLOR=#2900ff][B]try[/B][/COLOR]
               [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]new_start[/COLOR] & "##" & [COLOR=#3f7f00]counter[/COLOR] & "##" & [COLOR=#3f7f00]thefile_name[/COLOR]
               [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]no_error[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]true[/COLOR]
               [COLOR=#2900ff][B]exit[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
            [COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#2900ff][B]error[/B][/COLOR]
               [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]no_error[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]false[/COLOR]
            [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]try[/B][/COLOR]
         [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
      [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]try[/B][/COLOR]
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]tell[/B][/COLOR]
   [COLOR=#2900ff][B]return[/B][/COLOR] [COLOR=#3f7f00]thefile[/COLOR]
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#3f7f00]rename_file[/COLOR]

[COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#3f7f00]delete_from_list[/COLOR]([COLOR=#3f7f00]item2delete[/COLOR], [COLOR=#3f7f00]thelist[/COLOR])
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]cleanList[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] {}
   
   [COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]i[/COLOR] [COLOR=#2900ff][B]from[/B][/COLOR] 1 [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]count[/COLOR] [COLOR=#3f7f00]thelist[/COLOR]
      [COLOR=#2900ff][B]if[/B][/COLOR] {[COLOR=#3f7f00]thelist[/COLOR]'s [COLOR=#0000ff]item[/COLOR] [COLOR=#3f7f00]i[/COLOR]} [COLOR=#2900ff][B]is not[/B][/COLOR] [COLOR=#2900ff][B]in[/B][/COLOR] [COLOR=#3f7f00]item2delete[/COLOR] [COLOR=#2900ff][B]then[/B][/COLOR] [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]cleanList[/COLOR]'s [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]thelist[/COLOR]'s [COLOR=#0000ff]item[/COLOR] [COLOR=#3f7f00]i[/COLOR]
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
   [COLOR=#2900ff][B]return[/B][/COLOR] [COLOR=#3f7f00]cleanList[/COLOR]
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#3f7f00]delete_from_list[/COLOR]

[COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#3f7f00]md5_list[/COLOR]([COLOR=#3f7f00]alias_file[/COLOR])
   --[COLOR=#4c4d4d]INPUT: alias files of a folder[/COLOR]
   --[COLOR=#4c4d4d]OUTPUT: Record list of all files within this folder (1. Level)[/COLOR]
   --[COLOR=#4c4d4d] each record contains (thepath & md5)[/COLOR]
   [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder"
      
      [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]fileinfos[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] {}
      
      [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]a[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]original item[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_file[/COLOR]
      [COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#0000ff]kind[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]a[/COLOR] ≠ ([COLOR=#0000ff]kind[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#0000ff]folder[/COLOR] 1 [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#0000ff]startup disk[/COLOR]) [COLOR=#2900ff][B]then[/B][/COLOR]
         [COLOR=#2900ff][B]error[/B][/COLOR] "ALERT, ALIAS FILE IS NOT A FOLDER STOPPED!"
      [COLOR=#2900ff][B]else[/B][/COLOR]
         
         [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]thefiles[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]a[/COLOR]
         [COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]in[/B][/COLOR] [COLOR=#3f7f00]thefiles[/COLOR]
            [COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]does not[/B][/COLOR] [COLOR=#2900ff][B]start with[/B][/COLOR] "." [COLOR=#2900ff][B]then[/B][/COLOR]
               [COLOR=#2900ff][B]if[/B][/COLOR] ([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])) [COLOR=#2900ff][B]does not[/B][/COLOR] [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] "/" [COLOR=#2900ff][B]then[/B][/COLOR]
                  [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]md5_sum[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]do shell script[/COLOR] "md5 -q " & [COLOR=#0000ff]quoted form[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])
                  [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]fileinfo[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] {[COLOR=#3f7f00]md5[/COLOR]:[COLOR=#3f7f00]md5_sum[/COLOR], [COLOR=#3f7f00]thepath[/COLOR]:([COLOR=#0000ff]POSIX path[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])), [COLOR=#3f7f00]MacOSPath[/COLOR]:([COLOR=#3f7f00]thefile[/COLOR] [COLOR=#2900ff][B]as[/B][/COLOR] [COLOR=#0000ff]alias[/COLOR])}
                  [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]fileinfos[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#3f7f00]fileinfos[/COLOR] & {[COLOR=#3f7f00]fileinfo[/COLOR]}
               [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
            [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
         [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
      [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
      [COLOR=#2900ff][B]return[/B][/COLOR] [COLOR=#3f7f00]fileinfos[/COLOR]
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]tell[/B][/COLOR]
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#3f7f00]md5_list[/COLOR]

[COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#3f7f00]checkup[/COLOR]([COLOR=#3f7f00]script_folder[/COLOR])
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]orphan_alias[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]false[/COLOR]
   [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]allok[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]false[/COLOR]
   [COLOR=#2900ff][B]try[/B][/COLOR]
      [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder" [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]folder[/COLOR] [COLOR=#3f7f00]script_folder[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#0000ff]startup disk[/COLOR]
   [COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#2900ff][B]error[/B][/COLOR]
      [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder" [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]make[/COLOR] [COLOR=#0000ff]new[/COLOR] [COLOR=#0000ff]folder[/COLOR] [COLOR=#0000ff]at[/COLOR] [COLOR=#0000ff]startup disk[/COLOR] [COLOR=#0000ff]with properties[/COLOR] {[COLOR=#0000ff]name[/COLOR]:[COLOR=#3f7f00]script_folder[/COLOR]}
      [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder" [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]open[/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR]
      
      [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#2900ff][B]me[/B][/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]activate[/COLOR]
      [COLOR=#2900ff][B]error[/B][/COLOR] [COLOR=#3f7f00]script_folder[/COLOR] & " is empty, please place an ALIAS of each folders you would like to sync into this folder.
All aliases of Source folder you be named \"SOURCE...\" and the Destination Folder should be named \"DESTINATION...\""
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]try[/B][/COLOR]
   [COLOR=#2900ff][B]tell[/B][/COLOR] [COLOR=#0000ff]application[/COLOR] "Finder"
      [COLOR=#2900ff][B]if[/B][/COLOR] ([COLOR=#0000ff]count[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]alias file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR])) > 1 [COLOR=#2900ff][B]then[/B][/COLOR]
         [COLOR=#2900ff][B]if[/B][/COLOR] ([COLOR=#0000ff]count[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]alias file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]whose[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]starts with[/B][/COLOR] "SOURCE")) > 0 [COLOR=#2900ff][B]then[/B][/COLOR]
            [COLOR=#2900ff][B]if[/B][/COLOR] ([COLOR=#0000ff]count[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] ([COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]alias file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR] [COLOR=#2900ff][B]whose[/B][/COLOR] [COLOR=#0000ff]name[/COLOR] [COLOR=#2900ff][B]starts with[/B][/COLOR] "DESTINATION")) = 1 [COLOR=#2900ff][B]then[/B][/COLOR]
               [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]the_aliases[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#2900ff][B]every[/B][/COLOR] [COLOR=#0000ff]alias file[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]alias_folder[/COLOR]
               [COLOR=#2900ff][B]repeat[/B][/COLOR] [COLOR=#2900ff][B]with[/B][/COLOR] [COLOR=#3f7f00]k[/COLOR] [COLOR=#2900ff][B]in[/B][/COLOR] [COLOR=#3f7f00]the_aliases[/COLOR]
                  [COLOR=#2900ff][B]try[/B][/COLOR]
                     [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]h[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]original item[/COLOR] [COLOR=#2900ff][B]of[/B][/COLOR] [COLOR=#3f7f00]k[/COLOR]
                  [COLOR=#2900ff][B]on[/B][/COLOR] [COLOR=#2900ff][B]error[/B][/COLOR]
                     [COLOR=#0000ff]delete[/COLOR] [COLOR=#3f7f00]k[/COLOR]
                     [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]orphan_alias[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]true[/COLOR]
                  [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]try[/B][/COLOR]
               [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]repeat[/B][/COLOR]
               [COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#3f7f00]orphan_alias[/COLOR] = [COLOR=#0000ff]true[/COLOR] [COLOR=#2900ff][B]then[/B][/COLOR]
                  [COLOR=#2900ff][B]error[/B][/COLOR] "Hm, there is something wrong with the aliases, orphan alias files have been deleted... script stops"
               [COLOR=#2900ff][B]else[/B][/COLOR]
                  [COLOR=#2900ff][B]set[/B][/COLOR] [COLOR=#3f7f00]allok[/COLOR] [COLOR=#2900ff][B]to[/B][/COLOR] [COLOR=#0000ff]true[/COLOR]
               [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
            [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
         [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
      [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]tell[/B][/COLOR]
   [COLOR=#2900ff][B]if[/B][/COLOR] [COLOR=#3f7f00]allok[/COLOR] = [COLOR=#0000ff]true[/COLOR] [COLOR=#2900ff][B]then[/B][/COLOR]
      [COLOR=#2900ff][B]return[/B][/COLOR] [COLOR=#3f7f00]allok[/COLOR]
   [COLOR=#2900ff][B]else[/B][/COLOR]
      [COLOR=#2900ff][B]error[/B][/COLOR] "Hm, please check the alias folder, perhaps you have not placed all Aliases in in or maybe they are not name correctly"
   [COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#2900ff][B]if[/B][/COLOR]
[COLOR=#2900ff][B]end[/B][/COLOR] [COLOR=#3f7f00]checkup[/COLOR]
[/SIZE]

Hm, wenn ich es mir recht überlege, hätte das A Better Finder Renamer nicht auch irgendwie inbekommen? Egal, ich bin jetzt endlisch schön müde :cool:
 
  • Like
Reaktionen: MacMark und RedCloud

goeste

Jonagold
Registriert
04.04.07
Beiträge
23
Danke dir vielmals für deine Mühe ;) ich werde es gleich mal ausprobieren und berichten ;), versprochen!

//
ALSO ich muss sagen echt GENIAL THUMBS UP!!!!!

Mein Respekt (auch wenn der evtl NOCH nicht viel Wert ist ;))
 
Zuletzt bearbeitet:

hubionmac

Tydemans Early Worcester
Registriert
25.06.04
Beiträge
393
freut mich sehr, wenn es Dich freut:-*
 

t.r.e.w.

Boskoop
Registriert
30.05.07
Beiträge
39
Bei der Suche nach einer Lösung für meine bescheidenen Problemchen bin ich auf dein Script gestoßen. Ich hab es gleich probiert und finde es toll. Ein sehr nützliches Helferlein und sogar so gut, daß man genau aufpassen muß, was das Script alles leistet; ein scharfes Ding!
Vielen Dank
Harald