How do you change Screesaver folder with command line on Mac I have an art collection of 8000 pics, I have them divided into folders of about 200 each.  I'm going to use python to randomly select one of these folders so that my screensaver will continually show me the work of a new artist rather than randomly mixing all the artists together.  To do this I need to change the folder that the screensaver uses with Python which will then change the folder using Terminal.
I read this article and it seems that you can do that by using this command:
https://krypted.com/mac-security/mac-setting-screen-saver-from-the-cli/
defaults -currentHost write com.apple.screensaver modulePath -string &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot;

But that didn't work. Also, I am using macos 10.14
UPDATE
When I input: /usr/bin/defaults -currentHost read com.apple.ScreenSaverPhotoChooser I get the expected result, viz, the actual folder that the screensaver is using.  When I input: /usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser SelectedFolderPath -string &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot; then input /usr/bin/defaults -currentHost read com.apple.ScreenSaverPhotoChooser  I get
{
    CustomFolderDict =     {
        identifier = &quot;/Users/kylefoley/Pictures/art/complete art 2&quot;;
        name = &quot;complete art 2&quot;;
    };
    SelectedFolderPath = &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot;;
    SelectedSource = 4;
    ShufflesPhotos = 1;
}

Which is wrong because the path for the CustomFolderDict['identifier'] should be the same as the SelectedFolderPath
I then made a guess and tried:
/usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser CustomFolderDict -identifier &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot;

which outputted Unexpected argument.  If think I could figure out how to fix that CustomFolderDict with command line then that might solve the problem.
UPDATE 2
I inputted:
/usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser CustomFolderDict -dict-add identifier &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot;
/usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser CustomFolderDict -dict-add name &quot;claude monet&quot;

And although I get
{
    CustomFolderDict =     {
        identifier = &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot;;
        name = &quot;claude monet&quot;;
    };
    LastViewedPhotoPath = &quot;&quot;;
    SelectedFolderPath = &quot;/users/kylefoley/pictures/art/art 2/impressionism/claude monet/&quot;;
    SelectedSource = 3;
    ShufflesPhotos = 1;
}

When I input
/usr/bin/defaults -currentHost read com.apple.ScreenSaverPhotoChooser

The new result is just a blank screen with the name of my computer on it.
This works for me on a Catalina machine and is known to work on Mavericks (HT @bobsmith76 for persevering).
/usr/bin/defaults -currentHost write com.apple.ScreenSaverPhotoChooser 'SelectedFolderPath' &quot;/Users/you/sub/sub/folder&quot;

I used hot-corners to turn on the screen saver, and set different default, then when I enabled screen saver again it used the new folder.
NOTE if you have System Preferences open when making the changes then this may cause the wrong thing to happen (like the screensaver config flipping to a non-image screensaver - we both ended up on the Message screensaver this way).