Question

I try to download a file from webserver to local machine, but many files (folders) 1:1 to local.

ftp.retrbinary('RETR Text.txt', open('/dev/sda1/text.txt', 'wb').write)

[0Error: [Errno 20] Not a directory: '/dev/sda1/text.txt'

whats wrong? How can I put other paths here? can I use this I a loop, for downloading many files in a row?

EDIT: now it works at the first time, but if i disconnet the usb stick and connect it again, i cant access although the device is mounted at the same place (fdisk)...

No correct solution

OTHER TIPS

/dev/sda is a device file, not a directory on a filesystem. Try using

ftp.retrbinary('RETR Text.txt', open('/home/username/Desktop/text.txt', 'wb').write)

or something similar instead.

/dev/sda represents a SCSI device on your computer. In the case on /dev/sd*, it certainly represents a partition on your main hard drive. That means you can't access to any files on it unless you have mount it on your Unix system.

You need to mount the device on a folder in your hierachy (let's say /media/example) and accessing at your file via /media/example/test.txt instead of /dev/sda1/text.txt. Since it's /dev/sda, I guess it's already mount, and you should already found your file somewhere in your home...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top