Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.7: Auto-copy Photo Stream images to a folder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.7: Auto-copy Photo Stream images to a folder
Authored by: eyer on Feb 07, '12 06:58:14AM
I like this hint's idea and the commenters implementation with find. Here's what I came up with to poll every 20 seconds and put any new images in my downloads folder:
  1. A bash script that retrieves all new photo stream images from ~/Library/Application Support/iLifeAssetManagement/assets/
    #!/bin/bash
    #
    # save as ~/.streamtimeupdate
    
    find ~/Library/Application\ Support/iLifeAssetManagement/assets/ -newer ~/Downloads/.streamtime -iname *img* -print0 | xargs -0 -J % ln % ~/Downloads/
    touch ~/Downloads/.streamtime
  2. ~/LaunchAgents/us.eyer.streamtime.plist, which runs ~/.streamtimeupdate every 20 seconds.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    	<key>Label</key>
    	<string>us.eyer.streamtime</string>
    	<key>ProgramArguments</key>
    	<array>
    		<string>/Users/username/.streamtimeupdate</string>
    	</array>
    	<key>StartInterval</key>
    	<integer>20</integer>
    </dict>
    </plist>
Any suggestions for improvement?

[ Reply to This | # ]
10.7: Auto-copy Photo Stream images to a folder
Authored by: arcticmac on Feb 09, '12 07:25:32AM

Interesting with the use of 'ln' instead of 'ln -s'.

Considerably more work, but also considerably more sexy would be to write a little program (it would have to be complied rather than a script) that uses FSEvents to monitor that path instead of polling. But then you'd have to write some source code and compile it, and all... more effort than I want to go through right now.



[ Reply to This | # ]
10.7: Auto-copy Photo Stream images to a folder
Authored by: brianpratt on Feb 10, '12 07:32:34AM
Rather than running a script every 20 seconds, I set up a Folder Action on ~/Library/Application Support/iLifeAssetManagement/assets/sub from within Automator. The only thing in the workflow is a "Run Shell Script" Action with the following contents:
sleep 30 mkdir -p $HOME/Pictures/Photostream find $HOME/Library/Application\ Support/iLifeAssetManagement/assets/sub -iname *img* -print0 | xargs -0 -J % cp -n % $HOME/Pictures/Photostream
The "sleep" is to give time for the images to finish copying in (I couldn't get the "Wait for Files to Copy" action to work how I wanted). I chose to copy files (without overwriting old ones) but you could use symlinks as well with "ln -s" instead of "cp -n". I found that viewing the ~/Pictures/Photostream/ folder with symlinks in it is less than satisfying since the preview icons are generic link images instead of my images.

[ Reply to This | # ]
10.7: Auto-copy Photo Stream images to a folder
Authored by: DJF3 on Jan 29, '13 03:17:45AM

The only issue I have with this is that the copied files get the copy-date.. Would like the copied files to keep the <b>original file date</b>

Any idea how that could be done?



[ Reply to This | # ]
10.7: Auto-copy Photo Stream images to a folder
Authored by: DJF3 on Jan 31, '13 10:13:20AM

I might have found it..

Add '-p' to the cp command. -p will preserve a lot of things (see 'man cp')

Will test it in the next few days
DJ



[ Reply to This | # ]