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

Automatically copy Pocket PC work files on connect UNIX
I often forget to copy my Pocket Word documents to my desktop when syncing my Pocket PC. To get around this, I wrote a simple script that is run every one minute from cron. If the Pocket PC is connected, it copies my files, tells me, and exits. If the device is not connected, it exits harmlessly. This works great if you have Missing Sync set up to mount and sync on connect. Now I know I always have the latest copy of my work on my desktop.

Warning: This assumes you always edit on your PocketPC and it will overwrite the copies on your desktop. Work needed to extend the script to use timestamps to figure out which copy has been edited last, and overwrite the older one (a truer sync) has not been done.

#!/bin/sh
# cp_ppc_files.sh
#
# 
COPY_FROM=/Volumes/PocketPC/Flash\ ROM\ Disk/Personal/
COPY_TO=~/Desktop/pocket_pc_docs
COMPLETE_MSG="Pawkett P C sync complete"
MOUNT_POINT=/Volumes/PocketPC

#
# if the directory doesn't exist, we're not mounted
#
if [ -e "${COPY_FROM}" ]
then
  #
  # we're good to go, copy everything we said we wanted
  #
  cp -r "${COPY_FROM}" ${COPY_TO}
    #
  # when run from cron, the unmount fails for me.
  # probably many ways around this, but I just click "unmount"
  # when I hear the complete_msg
  # 
  umount ${MOUNT_POINT}
    if [ "${COMPLETE_MSG}" != "" ]
  then
    say ${COMPLETE_MSG}
  fi
fi
[robg adds: I haven't tested this one...]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,495 views]  

Automatically copy Pocket PC work files on connect | 2 comments | Create New Account
Click here to return to the 'Automatically copy Pocket PC work files on connect' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to make this script act immediately on connect?
Authored by: godo on Nov 15, '04 02:13:07PM

I'm planning a similar kind of script for automatically copying files to my mp3 player. Anyone know how to eliminate the cron job and trigger the script off of the action of mounting the volume?



[ Reply to This | # ]
How to make this script act immediately on connect?
Authored by: godo on Nov 24, '04 04:38:04PM

An alternative to using cron would be triggering this script with a Folder Action that checks whether a new item on the Desktop is the volume you want to act on.

The folder action approach might also solve the original poster's problem with his script - that when run as a cron job, the script will not unmount. There should be no problem doing this in Applescript.



[ Reply to This | # ]