Syncing folder from USB Stick


Forum: Apps
Topic: Syncing folder from USB Stick
started by: Zorak_asread

Posted by Zorak_asread on Feb. 09 2007,09:57
What I'm trying to accomplish is the following.

Assoon as I insert an USB Stick, I want DSL to automaitcly copy all the files from the stick to a folder on hda3.

Anybody got any Ideals how to do this, I figure through a script of some sort.

Thx :)

Posted by lucky13 on Feb. 09 2007,14:18
Quote (Zorak_asread @ Feb. 09 2007,04:57)
What I'm trying to accomplish is the following.

Assoon as I insert an USB Stick, I want DSL to automaitcly copy all the files from the stick to a folder on hda3.

Anybody got any Ideals how to do this, I figure through a script of some sort.

Thx :)

I can think of several ways of doing it, but I'm left with more questions why I'd want to do that. Are you doing this via the CD, frugal, or hard drive install?

Are you going to be using multiple sticks? If just one stick, why not just mount in emelfm and copy everything by highlighting the whole stick? Are you willing to give up your use of all USB media strictly for this use? Or would you need a way to stop and start the automatic sudo mounting and copying * to hda3? Do you want it to overwrite things in the same directory on hda3 or go to new directories each time?

Personally, I don't think it's a good idea to automatically do something like that when it's easy enough to use something like emelfm as root, highlight, and copy; or even just use your bash history (up-arrow key) to mount/umount and cp. It's not going to save you that much time unless you're copying loads of sticks on a frequent basis. And it would render USB pretty much useless for other media unless you had a stop/start to the script.

Posted by Zorak_asread on Feb. 09 2007,22:26
I'm creating a pictureframe PC. DSL installation with a folder in which I place my images. This machine isn't connected to any network, so what I want to do is just plug in my USB stick, and have this action result in the execution of a script that will copy over the new files from the stick to the harddisk, and then restart my image viewer so the new images are included in its filelist.

My problem is that I don't know how to get a script to run in response to the insertion of the USB stick. Suggestions?

Posted by beakmyn on Feb. 09 2007,23:53
I have the script on my site that another user posted (yes I forget to give him/her credit) < http://www.frontiernet.net/~pictureframe >

As I understand it the only "automatic" way is to boot with the drive inserted and let bootlocal.sh kickoff the script, since there's no easy to continuously poll for a usb drive and mount it/run a script.

Posted by mikshaw on Feb. 10 2007,04:01
I'd say the most useful method (or at least one of) would be to set up a hotkey.  Instead of a script constantly running, checking to see if a stick has been inserted (and whether this stick is not the same as the one that was previously inserted), you could simply plug in the stick and then press a key or combination of keys to launch the script. This also removes the need to have your stick plugged in at boot time, and can be done at any time.

Automating can get a bit overused at times....sometimes it's better to save the development time and effort, as well as cpu load, and trade it for minor physical activity.

Posted by beakmyn on Feb. 10 2007,21:07
I think he wants to automate to make is transparent to the user. If his frame is anything like mine there is no keyboard or mouse hooked up. The interaction is through ssh. That being said lets assume you're giving this a as a gift to your parents who aren't very computer literate. I was thinking something that would detect the usb, mount it, display a "please wait" picture, copy all .jpg files, restart the slideshow.
Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.