How to make script files automatically transfer from your USB to the robot?

I currently have to keep /programs/usbdisk/ in my java path to my script files in order to run my Cap, making it only possible to run while the USB is connected. I would like to have it so that the files load into the robots programs folder automatically so that the cap can run without the usb connected after the first time you load it. Could someone let me know if/how this is possible?

Best,
Karsten Sladky

Shellscript-filenames prefixed with urmagic will be executed automagically on plugging the USB.
You could use this to setup your needed files to your own folder in the robots.

If a user selects a file, that is stored on a USB drive, why not copy it with the users permission from the USB drive and into the programs folder - and then use that location.

E.g. you query the user to select a file. If the filepath points to a removable memory, then you query the user, that the file will be moved to /programs/+relativepath from USB. If user accepts, then you copy the file, and have your code point towards this file instead.

@jbm in one of your other posts you mentioned that custom urmagic files are not supported? If they are not supported, what is the proper java technique to transfer the files after prompting the user, just a file writer? I am sure I am missing something obvious, but I have looked on here, zacobria forum, the tutorial, etc… and I can’t find anything on proper methods for transferring files from a usb.

Sorry for the inconvenience,
Karsten

Custom magic files are not recommended.

If you are using a URCap, I would suggest simply using java.io.FIle or a similar generic class, to copy files from USB to the /programs/ folder if accepted by the user.

Without using URCaps, the general approach is, to open the file, and for the user to “Save as” in an appropriate location.

Thank you so much for the response, I figured it was going to be something simple, but I wanted to make sure I was doing it in a proper manner.