This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Remote access to USB drive
#1
Hi,

I can write to a USB drive, then unplug it and read the contents on another computer. However, Is there a way to reads the USB drive contents remotely?

I was thinking to FTP in via the apps' credentials, and this allows me to see the /user directory. I can see files I have put into that directory via previous FTP sessions.

However, can I FTP my way to the USB contents? Or, as second best, how to write the code to copy a file from the USB dive to the /user directory, which I can then retrieve via FTP.

I have been playing with the following code:

Code:
-- Write a test USB stick file

res, err = mount_usb()

log('After mounting, result is', res, err)

if res then
  f, err = io.open('/mnt/testfile', 'a')
  if f ~= nil then
   
    f:write(os.date("Starting log at %X on %A, %d %B %Y")..'\n')
    for i = 1, 10 do
      f:write('Hello!'..'\n')
    end
    f:write(os.date("Finished log at %X on %A, %d %B %Y")..'\n')   
    f:close()
    log('Wrote to USB drive')

  else
    alert('Unable to write to file: ' .. err)
   
  end
  os.execute('cp /mnt/* /user') -- doesn't work
  os.execute('touch /user/Test.tst') -- doesn't work
  os.execute('touch /mnt/Test.tst') -- works!
  os.sleep(2)
  log('finished')
  unmount_usb()
 
else
  alert(err)
end

The first lot of code works and creates the 12 line file on the USB stick. The other os.execute commands either work or don't work as shown. Am I heading down the right path?

So, my questions summarised:
1) Can we reach the USB drive directly via FTP?
2) Failing that, can we copy files from the USB drive to the /user directory?

Thanks!
Reply


Messages In This Thread
Remote access to USB drive - by tassiebean - 10.10.2020, 03:21
RE: Remote access to USB drive - by admin - 12.10.2020, 06:46

Forum Jump: