Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。
Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台
Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。
Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。
import os def _mk_dirs(path:str): paths = path.split('/') pathToCreate = '' for x in paths: mkdir(pathToCreate + x) pathToCreate = pathToCreate + x + '/' # different micropython versions act differently when directory already exists def mkdir(path:str): try: os.mkdir(path) except OSError as exc: if exc.args[0] == 17: pass def _exists_dir(path) -> bool: try: os.listdir(path) return True except: return False def _copy_directory( fromPath, toPath): if not _exists_dir(toPath): _mk_dirs(toPath) for entry in os.ilistdir(fromPath): is_dir = entry[1] == 0x4000 if is_dir: _copy_directory(fromPath + '/' + entry[0], toPath + '/' + entry[0]) else: _copy_file(fromPath + '/' + entry[0], toPath + '/' + entry[0]) def _copy_file(fromPath, toPath): with open(fromPath) as fromFile: with open(toPath, 'w') as toFile: CHUNK_SIZE = 512 # bytes data = fromFile.read(CHUNK_SIZE) while data: toFile.write(data) data = fromFile.read(CHUNK_SIZE) toFile.close() _copy_directory("app", "app123")
Copyright © 2014 ESP56.com All Rights Reserved
执行时间: 0.0069410800933838 seconds