Well. A timeout problem with a different script probably warrants a separate topic. But reading through the code, I can’t see any obvious timeout bottlenecks. There are things which strike the eye:
- The entire code’s in a single ‘with timeout …’ statement. It’s probably best to limit such statements to areas where they may be needed, but I can’t justify this assertion off the top of my head at the moment.
- The script makes lots of new names, but doesn’t do anything with them.
- At the end, it attempts to move the files to the text “Hard Drive:Users:Macintosh:Documents:Security Videos:Security Videos” instead of to a folder specifier.
Unlike copying, simply moving items to a different folder on the same disk doesn’t involve gigabytes of data as the items themselves aren’t physically duplicated or moved. The disk directory’s simply modified to change the path to them. But I don’t know how many items the Finder can ‘move’ at once. (The Finder doesn’t do the moving itself, of course, but passes on instructions to macOS’s disk management routines.)