codez / ImportPhotoFolders

Import a folder hierarchy as albums into OS X Photos.
MIT License
248 stars 42 forks source link

Limit to number of files in each folder? #8

Closed KumbiaKid closed 8 years ago

KumbiaKid commented 8 years ago

Thanks for creating this script! It saved my bacon big time! I did run across what seems to be an undocumented limit on the number of files in each folder. I haven't done the trial-and-error to narrow it down completely, but it seems that 998 is too many, but 750 works. Is there some limit to the number of items (file names?) that can be stored somewhere? Might it be possible to increase that limit via some type of declaration?

A bit more detail about what happened: I have some folders containing very large numbers of photos. One that I experimented with has 2,461 jpg images, but I have others much larger (I want to use Photos to organize them). Attempts to import this folder failed with an unspecified Finder error. Since I suspected the problem was due to the number of files in the folder, I created 4 subfolders in Finder and moved roughly 1/4 of the files to each subfolder. The script worked. I first guessed 1024 might be the magic number, so rearranged the subfolders so one had 1023 files and tried to import that - it failed. Same for 1000 (which I thought would be a more convenient number to deal with), 999, & 998. Then I tried 750 and that worked fine. So it seems there's a limit of somewhere between 750 and 998 - or is it to do with the total size of aall the files?

KumbiaKid commented 8 years ago

P.S. The specific error message I saw was: ["Finder got an error: AppleEvent timed out. number -1712] when there was an error message - sometimes everything just hung.

kudit commented 8 years ago

There is probably a script processing timeout with a limit on the number of seconds. There's probably no way around this as a script without writing an app.

KumbiaKid commented 8 years ago

Thanks for the reply. So it looks like the only solution is to limit the number of files in any one folder to a number can be processed within the (unknown) timeout limit. Tedious sometimes, perhaps, but workable.

kudit commented 8 years ago

If you find out a consistent max number, the script could be modified to give a warning if there's folder with that many files (or we could just add that information to the description).

codez commented 8 years ago

Have a look at ImportPhotoFolders.applescript#L40 There is a timeout of 600 seconds (= 10 minutes) defined per folder. Try to increase this value and check if the error still appears.

codez commented 8 years ago

Fixed by #13