Hello,
I need to put in the filesystem a large quantity of text files (.txt) that contain precompiled datas.
Those files are in the order of the hundreds (minimum requirement is 100). Instead of copying them one by one I thought to embed them in the image.
I tried putting them in the \script folder but I once I flashed the image seems that they can't be read (or I don't know how to read them).
What is the fastest way to copy hundreds of file in the mcu?
Thanks you!
Copy lots of files in the mcus
Re: Copy lots of files in the mcus
The files in the scripts and modules folders that go into flash cannot be read, only imported as python scripts. You could try my ftp script in https://github.com/robert-hh/ESP8266-FTP-Server.git. It is too large to run as python soource The best is to put that into the /modules folder and create an flash image, or to pre-compile it with mpy-cross and load the .mpy file.
The ftp server supports the mput command of the command line ftp. You could also use filezilla or fireftp for the transfer, which give you a nice two-pane view of the files. Just be careful to configure these for single session only..
The ftp server supports the mput command of the command line ftp. You could also use filezilla or fireftp for the transfer, which give you a nice two-pane view of the files. Just be careful to configure these for single session only..
Re: Copy lots of files in the mcus
I'd give a try to ampy:
(assuming all your txt files are in one directory)
adjust port and especially baud to have the most reliability
OR (with bash):
OR with webrepl (assuming 192.168.1.100 is your device address)
check of course to have in the path ampy and webrepl_cli.py
Code: Select all
ls *.txt | xargs -n 1 ampy --port /dev/ttyUSB0 --baud 115200 put
adjust port and especially baud to have the most reliability
OR (with bash):
Code: Select all
for f in `ls *.txt`;
do ampy put $f ;
done;
Code: Select all
for f in `ls *.txt`;
do webrepl_cli.py put $f 192.168.1.100/$f;
done;
Re: Copy lots of files in the mcus
Thank you both!
I went for a bash script this time, but I will add the ftp module in all my images from now on. I didn't test it yet, but you never know when it can comes in handy and saves the day!
Thanks and regards!
I went for a bash script this time, but I will add the ftp module in all my images from now on. I didn't test it yet, but you never know when it can comes in handy and saves the day!
Thanks and regards!
Re: Copy lots of files in the mcus
Tony just added recursive put to ampy too: https://github.com/adafruit/ampy/commit ... a77059cefa