Forum

Copy files from usb stick

hi,

I like to display images from a directory as a slideshow in an installation.

when a usb stick is plugged the contents should copied to a directory. perhaps with date string for sorting the folders). the v4 part, choosing the folder and display the images is allmost done.

but how can I copy these files in the background or check if there is a usb stick? inside v4 or should I use batch scripts?

regards

a bit of a hacky way could be to use the string output of Renderer (TTY) to check when a usb-stick is added removed. note how some-debug info is written to the tty in that moment.

then use Copier (File Async) to copy your files…

I need to do exactly this right now. Two questions:

  1. the TTY only says something like “enumerating game devices”. Is there a way to get a little bit more verbosity?
  2. How can I get a line of the TTY as a string for further usage?

Thanks!

i’m afraid it seems the string output of tty isn’t working. so atm i don’t see a way - out of the box - to get the info if a usb-device is connected.

on the other hand it seems to be just a few lines of code in your own plugin: see eg: http://stackoverflow.com/questions/620144/detecting-usb-drive-insertion-and-removal-using-windows-service-and-c-sharp

i used this to detect if a certain Drive exists… if you need to check many devices (because your sticks maybe have different drive-letters or so) you have to patch some logic around like checking a spread of drive letters.

fun-fact: in my short tests this was faster than the windows explorer

Exists (Directory) (8.3 kB)

Okay, thanks! I hacked my patch with a comparision of connected drives with an Info(System Drives). It works ok for my simple application.

BTW, there are some neat tools from http://www.uwe-sieber.de that come in handy when you fiddle with USB Devices. One little prog can make sure that attached USB Drives alway get the same letter applied, for example.