PS: I forgot to complete the title, but can't find a way to change it, nor delete the posting... 
I would like to restore some files (replace existing, damaged files from a backup). With hundreds of files spread in lots of folders/sub-folders this will take forever to do manually.
So I was wondering if I could automate this with a script (Automator or Applescript perhaps)? In theory I believe it would do something like this:
1) Open up a dialog window asking the for the base folder of the files to be restored (the root folder which contains all the sub-folders where the damaged files are located)
2) Open up another dialog window asking where the backup files are located (a single folder with all the (OK) files)
3) Looking at the backup folder, take a note of the first file's name.
4) search through the entire backup folder (and its sub-folders) for a file with that exact same name and extension
5) if found, move and overwrite the (damaged) file with the (OK) backup file. Possibly with a confirmation dialog first
NOTE: a variation of the script could be made for step 2 where the exact same file/folder structure is used for the backup (of course only containing the files to replace with -the rest must be deleted using the Finder's search filtering). I assume this will speed up the restoring process as the script would only have to compare the two file structures which are identical.
Also, as an added safety feature -in step 5, rename the original (damaged) files with a preceeding "ORIGINAL_" instead of overwriting them. Could come in handy in case something goes wrong. I can easily delete the in the finder by searching for files with said base folder using the name "ORIGINAL_".
Does anyone know of such a script or how it could be made?
I would like to restore some files (replace existing, damaged files from a backup). With hundreds of files spread in lots of folders/sub-folders this will take forever to do manually.
So I was wondering if I could automate this with a script (Automator or Applescript perhaps)? In theory I believe it would do something like this:
1) Open up a dialog window asking the for the base folder of the files to be restored (the root folder which contains all the sub-folders where the damaged files are located)
2) Open up another dialog window asking where the backup files are located (a single folder with all the (OK) files)
3) Looking at the backup folder, take a note of the first file's name.
4) search through the entire backup folder (and its sub-folders) for a file with that exact same name and extension
5) if found, move and overwrite the (damaged) file with the (OK) backup file. Possibly with a confirmation dialog first
- if the same filename is found in several locations, present a dialog asking if said file (one by one) should be replaced or not
6) go back to step 1, continuing with the next fileNOTE: a variation of the script could be made for step 2 where the exact same file/folder structure is used for the backup (of course only containing the files to replace with -the rest must be deleted using the Finder's search filtering). I assume this will speed up the restoring process as the script would only have to compare the two file structures which are identical.
Also, as an added safety feature -in step 5, rename the original (damaged) files with a preceeding "ORIGINAL_" instead of overwriting them. Could come in handy in case something goes wrong. I can easily delete the in the finder by searching for files with said base folder using the name "ORIGINAL_".
Does anyone know of such a script or how it could be made?
Last edited: