Mac OS X: Smart Folders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Dave2002
    Full Member
    • Dec 2010
    • 17841

    Mac OS X: Smart Folders

    OK - here is one to make anastasius and mrgg laugh!

    I have been experimenting with Smart Folders, in Mac OS X, and they are moderately useful. However, some features are infuriating.


    Consider the following. You have a machine with a rather full hard drive. You want to clear off anything over a certain size to an external drive - possibly selectively, but maybe not. Maybe you are going to be happy just to clear the space, and sort things out later.

    OK - so finding files which are over a given size is easy.

    In Finder set up a search with File size greater than 500 Mb. This will identify big files.



    Unfortunately (sob) it will identify files on all the connected drives.

    What one might want to do is to copy all the found files to one of the drives, but excluding any which are already on an external drive.

    In its usual infinite wisdom, Apple provides just about everything else other than anything actually useful.

    I suppose one could be gung ho, and just try anyway, in the hope that files which already exist on an external drive won't be copied to themselves - but that seems too risky.

    Pity - because this has the potential to be just ever so much more powerful, if only the Apple people used their noddles a bit more.

    It is clearly possible to go through the found list manually, selecting only the files which are on the main drive for export, but that is a disappointing way to get round an issue which should
    be capable of serious automation. I guess it's possible (must be) to write a shell script to do this, and run in Terminal, but one really shouldn't have to.
    Last edited by Dave2002; 19-02-17, 17:16.
  • MrGongGong
    Full Member
    • Nov 2010
    • 18357

    #2
    Is there no way of specifying where to search in a way that excludes connected drives ?

    Comment

    • Dave2002
      Full Member
      • Dec 2010
      • 17841

      #3
      Originally posted by MrGongGong View Post
      Is there no way of specifying where to search in a way that excludes connected drives ?
      You try and find it....!!!! Good luck .... Of course the simplest way is to physically disconnect all the connected drives - but then one has to connect one later on - as (possibly!!!) the point of the exercise is to clear off files without losing them so as to create working wpace. It's possible that connecting yet another non empty drive (see below) will trigger the cleverness of the smart folder - and mess up the search yet again - I don't know.

      I've spent days/weeks on this. Re the slightly similar Smart Mailboxes there is a way - which is to use an extra condition - "Is In" or "Is Not In" a given smart mailbox, but there's no such thing as far as I can see in the Finder for Smart Folders. I think Apple have a somewhat ad-hoc approach to putting features in their systems. If they ever get organised, remember you saw it here first.

      If you find a way, please let me know.

      There is a slightly more tedious way of doing this which might work.

      1. Get a big enough disk drive to copy all the files to.
      2. Format it - so it's empty - and hence won't affect any search with a positive find.
      3. Make sure there are no other drives connected.
      4. Run the Finder search, and then copy all the files to a folder on the drive.
      Again, one has to hope that the process doesn't go into a loop - which a procedural approach to systems programming might do.
      A functional programming approach would avoid this.
      5. At the end of this it may be worth running a uniqueness program on the folder - such as Gemini,
      to avoid having loads of duplicates.

      I've no idea if Windows 10 has caught up with any of this - I rather doubt it.

      I did look at doing the thing in Unix/Linux and ran a 'find' over my directories, but it looked as though sorting that out to generate an automated approach to the problem was going to take quire s long while. It may turn out, eventually, to be the only way that works, though.

      Comment

      • Frances_iom
        Full Member
        • Mar 2007
        • 2407

        #4
        1st point why continue banging your head against the apple garden wall
        2nd all O/Ss reinvent Unix but do it badly

        why not null filelist + chksum; cycle (recursively) thro all directories you need to clear appending filename of > size X to filelist;add md5 of sd file to chksum; copy all files in file list to your save memory; check chk sum of chk sums of all copied files matches; if so delete all files in filelist

        (if very large # of files you may need to place each filename as a line in a text file rather that append to a string - likewise you may need to quote file names if you have used some special chars in file names)

        Comment

        • Dave2002
          Full Member
          • Dec 2010
          • 17841

          #5
          Originally posted by Frances_iom View Post
          1st point why continue banging your head against the apple garden wall
          2nd all O/Ss reinvent Unix but do it badly

          why not null filelist + chksum; cycle (recursively) thro all directories you need to clear appending filename of > size X to filelist;add md5 of sd file to chksum; copy all files in file list to your save memory; check chk sum of chk sums of all copied files matches; if so delete all files in filelist

          (if very large # of files you may need to place each filename as a line in a text file rather that append to a string - likewise you may need to quote file names if you have used some special chars in file names)
          Actually I don't think that Unix is/was the best ever OS. It was good for its time, but it should be possible to do better now. Unfortunately hardly anyone seems to care these days, so that for every good idea put forward, there are a couple of steps backwards.

          There are some brute force methods, but they are hardware and resource intensive. For example, take a spare hard drive, copy all the files to it, then delete all the ones (possibly selectively) above a minimum size on the original drive. If it matters, the complement file set could be deleted off the external drive.

          There ought to be ways which are effective, and which are reasonably elegant, and don't require a huge amount of human intervention. Sadly I think that few people care about this these days. Perhaps in some hidden labs there are people using kit in sensible and intelligent ways, but there's not much evidence in the consumer market.

          In days gone by I would perhaps have made a list of all the files for copying and or deletion - ls or find could do that. Then edited it to make a script file, which would then be executed. However, such practices are dangerous if there are errors and if there is inadequate testing.

          It also just seems a shame that Apple have managed to get part of the way towards something useful and usable, but done so in a haphazard way, so that the possible functionality is crippled. It might not take a lot of effort to push things forward, but I doubt that they'll bother. Tinkering round the edges seems to be "the way forward"!

          Comment

          • Anastasius
            Full Member
            • Mar 2015
            • 1806

            #6
            Originally posted by Dave2002 View Post
            Unfortunately (sob) it will identify files on all the connected drives.

            ...
            Not on my Mac..it just gives me those on my Mac and not those elsewhere on connected drives. At least, I am assuming that if you had a backup drive connected then you would have two instances of each file in the results list. I certainly just get one entry per unique filename.
            Fewer Smart things. More smart people.

            Comment

            • Dave2002
              Full Member
              • Dec 2010
              • 17841

              #7
              Originally posted by MrGongGong View Post
              Is there no way of specifying where to search in a way that excludes connected drives ?
              I have to fess up now, and suggest that there may be. You might argue that it's a case of RTFM - except that there isn't a manual that I can see, and playing with this to find out how the interface works is somewhat a matter of trial and error. Also, I can't confirm absolutely that things will be the same in all recent versions of OS X, as my explorations of the recently observed phenomenon have been done in Mountain Lion - though it shouldn't take long to check out a few of the other systems.

              I also think there is state dependent behaviour, which a user needs to be aware of (beware of?).
              This is an original test searching for the name 'Rubbish'. The one below shows the same test, but applied across all the attached drives.




              Users should not select the This Mac option unless they really want the search to be done across all drives, and the results all put together.

              The state dependent behaviour also seems to depend on which drive is being accessed when the search is first made.

              There are other "gotchas" - as sometime searches don't seem to be duplicated or copied properly, so it's always best to check the criteria each time a search is run. Once these problems have been noted things do seem more manageable.

              If only searches on the main drive are needed, one way to be sure that happens is to dismount the other drives.

              Comment

              • Anastasius
                Full Member
                • Mar 2015
                • 1806

                #8
                I select 'This Mac' and it just searches my iMac. Maybe yours is on steroids, D2002?
                Fewer Smart things. More smart people.

                Comment

                • Dave2002
                  Full Member
                  • Dec 2010
                  • 17841

                  #9
                  Originally posted by Anastasius View Post
                  I select 'This Mac' and it just searches my iMac. Maybe yours is on steroids, D2002?
                  Do you have any other drives connected? If not, then it clearly won't find any files on any external drives which are not connected!

                  Comment

                  • Dave2002
                    Full Member
                    • Dec 2010
                    • 17841

                    #10
                    Almost a gotcha - upgrading to El Capitan

                    I recently migrated my MBP to El Capitan, and may move it and another machine on swiftly to Sierra in a short while.

                    El C seems to be working OK, but today I noticed that the Smart Folders I'd set up and which had been visible in the Finder Sidebar were no longer there.

                    I don't know why this happened, though I suspect from doing searches I'm not the only one to have noticed that this can be a problem when carrying out OS upgrades.

                    I then used a specific search to find the folder "Saved Searches", which contains a lot of files, each representing a single search, and then experimented to see if they still worked. It soon became apparent that they could be re-activated and would function as before - but how to get them visible and back into the Sidebar? Another search suggested selecting a Save Search file, and then, in Finder, selecting File and then the key combination CTRL - CMD - T, which puts one of the searches back to the sidebar. I tried selecting all of them, using CMD-A, then the same CTRL-CMD-T combination, but that doesn't work. However, it is possible to select several searches in one go using standard file selection techniques, and then the CTRL-CMD-T does work.

                    It didn't take long to recover all the saved searches and put the ones I wanted back into the sidebar.

                    Oddly, the somewhat similarly "engineered" Smart Mailboxes in Mail seem to have been unaffected by the upgrade.

                    Comment

                    • Dave2002
                      Full Member
                      • Dec 2010
                      • 17841

                      #11
                      Boolean operators and smart folders

                      I have previously mentioned the lack of Boolean operators within the interface for Smart Folders.

                      However, this page does mention them - though they don't actually work as one might really want at the top level.



                      It is, however, possible to select items by Kind - for example as follows (***): movie date:09/11/16-14/11/16 OR kind:image date:09/11/16-14/11/16

                      as in this example:



                      The example image doesn't show the full search expression, which was as above (***) and seemed to work OK.

                      With ingenuity it is sometimes possible to use this idea to useful effect, though it would have been much better if the AND, OR, NOT (plus Brackets '(' ')' ), NAND, NOR operators had been built into the top level search interface, rather than within the attributes etc.

                      Comment

                      • Dave2002
                        Full Member
                        • Dec 2010
                        • 17841

                        #12
                        Editing searches to create new ones - El Capitan

                        Yet again Apple seems to think it knows better than I do what I want - or don't want!

                        In El Capitan it now doesn't seem to be possible to duplicate a search for a smart folder (side bar in the Finder) and then edit the copy to create a new one.

                        Thus more complex searches always have to be built up from scratch - which is OK - but a bit of a nuisance.

                        I've not checked in Sierra - will do eventually.

                        I'm sure I was able to do this in some earlier versions of Mac OS X (Snow Leopard, Mountain Lion) by various techniques. I think Apple are hell bent on wrecking user experience sometimes.

                        If I've overlooked something I'd be glad to know. As usual, one step forward, n steps backwards (where n>=1)!

                        Comment

                        Working...
                        X