Skip to content

Commit

Permalink
uftpd.py, readme: Add MDTM command
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-hh committed Dec 31, 2019
1 parent b33e9dd commit b8d8313
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Paul made webrepl with the framework for background operations, which then was u
also by Christopher to implement his utelnetsever code.
My task was to put all these pieces together and assemble this uftpd.py script,
which runs in background and acts as ftp server.
Due to its size, it either has to be integrated into the flash image as frozen
Due to its size, for ESP8266 it either has to be integrated into the flash image as frozen
bytecode, by placing it into the esp8266/modules folder and performing a rebuild,
or it must be compiled into bytecode using mpy-cross and loaded as an .mpy file.
The frozen bytecode variant is preferred.
Expand Down
6 changes: 6 additions & 0 deletions ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ def ftpserver():
else:
cl.sendall(msg_550_fail)
fromname = None
elif command == "MDTM":
try:
tm=localtime(uos.stat(path)[8])
cl.sendall('213 {:04d}{:02d}{:02d}{:02d}{:02d}{:02d}\r\n'.format(*tm[0:6]))
except:
cl.sendall('550 Fail\r\n')
elif command == "STAT":
if payload == "":
cl.sendall("211-Connected to ({})\r\n"
Expand Down
6 changes: 6 additions & 0 deletions ftp_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ def ftpserver(not_stop_on_quit):
else:
cl.sendall(msg_550_fail)
fromname = None
elif command == "MDTM":
try:
tm=localtime(uos.stat(path)[8])
cl.sendall('213 {:04d}{:02d}{:02d}{:02d}{:02d}{:02d}\r\n'.format(*tm[0:6]))
except:
cl.sendall('550 Fail\r\n')
elif command == "STAT":
if payload == "":
cl.sendall("211-Connected to ({})\r\n"
Expand Down

0 comments on commit b8d8313

Please sign in to comment.