This shows you the differences between two versions of the page.
— | sdk:download-to-usb [2015/09/04 14:27] (current) – created juraschek | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Download a File and Store it to a USB Flash Drive ====== | ||
+ | If you need to download a File and store it to a USB flash drive attached to a router you can use the script below. | ||
+ | |||
+ | You need to configure the download URL and the local File name at the beginning of the script | ||
+ | |||
+ | <code c> | ||
+ | ## URL where to download from | ||
+ | DOWNLOADURL=" | ||
+ | ## URL where to save the file to (without USB Media Folder) | ||
+ | LOCALFILE=" | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | <code c download-to-usb.are> | ||
+ | |||
+ | |||
+ | ## URL where to download from | ||
+ | DOWNLOADURL=" | ||
+ | ## URL where to save the file to (without USB Media Folder) | ||
+ | LOCALFILE=" | ||
+ | |||
+ | |||
+ | ## FTP/HTTP Credentials | ||
+ | USR=""; | ||
+ | PWD=""; | ||
+ | |||
+ | USBDEV=" | ||
+ | USBDIR="/ | ||
+ | |||
+ | ret = nb_media_mount(USBDEV); | ||
+ | if (ret == 0) { | ||
+ | nb_syslog(" | ||
+ | } | ||
+ | else { | ||
+ | nb_syslog(" | ||
+ | } | ||
+ | |||
+ | |||
+ | mounted = nb_media_getmount(); | ||
+ | nb_syslog(sprintf(" | ||
+ | |||
+ | |||
+ | |||
+ | if (nb_transfer_get(USR, | ||
+ | nb_syslog(" | ||
+ | } else { | ||
+ | nb_syslog(sprintf(" | ||
+ | } | ||
+ | |||
+ | nb_media_umount(USBDEV); | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | </ |