I am trying to write a script which will select all non-folders in a given Finder window which is in List View and has revealed/expanded all sub-folders (see image).
As there tend to be many more files than folders, my thought is to:
- Select all items
- Deselect all folders
I am also willing to start with nothing selected and then add non-folders to my selection.
In any case, I'm stumped. Any help would be appreciated.
Desired result would look similar to this:
EDIT: (to answer the xy problem - it's gonna be long, but you asked for it)
I repair computers for a living, which means I do a lot of "Backup data, erase hard disk, install OS, restore data" all the time. Both Windows and Mac, although I do all the backups on my Mac, so the client's data is restored from a Mac volume via the network.
Usually, I just drag entire folders from backup volume to restored Windows PC and wait for it to finish. Sometimes, though, the copy fails, often because "the pathname is too long" or some such nonsense. In such cases, I end up copying smaller chunks at a time until I'm done.
Then I have to check and double check that I haven't missed any files/folders. So, I open two windows, one with the source folder, the other with the destination folder. And I compare folders (Music, Docs, etc.) from each. I look to see if the number of files/folders match and that the amount of bytes used is the same.
Often, because of the .DS_Store in Mac folders, the bytes don't match. If I open the folder and Get Summary Info
on just the contents, the byte counts match up perfectly.
So, rather than open dozens or hundreds of folders and subfolders, one by one, what I do is open the Documents
folder, for example, in list view, reveal all subfolders (this much I can do in AppleScript already) and then I Select All
and de-select the folders, and then Get Summary Info
.
In my image above, I could do it manually, of course. But, in many cases, I have folders with hundreds of files and several folders deep. If I do it manually, it takes a long time and inevitably, right before deselecting the last 10 folders, I'll make an errant click and have to start all over.
This is why I want a script to select all non-folders.
If there is another solution, great. Let me hear it.
--modify-window
switch or it can end up copying everything every time. :)