Question

I created a smart folder using Finder containing images that I would like to sync to my iPhone. When I opened iTunes and tried to select that folder to sync images into my iPhone, the folder was grey and I was unable to select it.

Does any workaround exist that makes it possible for me to accomplish this synchronization?

Était-ce utile?

La solution

I wrote this python script that searches for all files with a blue label (color 4) in a directory and copies it to a regular folder instead of a smart folder.

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os

// You can add several label searches and put them into separate "smart" directories
configuration = [
            { "color": "4", "location": "/Absolute/path/to/destination directory" }
        ]

for config in configuration:
    color = config["color"]
    location = config["location"]

    os.system("mdfind -onlyin /Absolute/path/to/search/directory -literal 'kMDItemFSLabel = 4' > /tmp/favs.txt")
    os.system("rsync -a --progress --no-relative --files-from=/tmp/favs.txt  / \""+location+"\"")
    files_list = os.listdir(location)
    for file in files_list:
        if not file in open('/tmp/favs.txt').read():
            print("Removing "+file)
            try:
                os.remove(location+file)
            except OSError:
                pass

This script only searches for labels, and not all the other functionality a smart folder can have. For something like this, I would recommend Hazel which is an app where you can make rules for e.g. copying files to a directory based on criteria.

Licencié sous: CC-BY-SA avec attribution
Non affilié à apple.stackexchange
scroll top