summaryrefslogtreecommitdiff
path: root/tools/pyboard.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/pyboard.py')
-rwxr-xr-xtools/pyboard.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/pyboard.py b/tools/pyboard.py
index 60cc06508..043f4f06f 100755
--- a/tools/pyboard.py
+++ b/tools/pyboard.py
@@ -476,6 +476,13 @@ class Pyboard:
t = str(self.eval("pyb.RTC().datetime()"), encoding="utf8")[1:-1].split(", ")
return int(t[4]) * 3600 + int(t[5]) * 60 + int(t[6])
+ def fs_exists(self, src):
+ try:
+ self.exec_("import uos\nuos.stat(%s)" % (("'%s'" % src) if src else ""))
+ return True
+ except PyboardError:
+ return False
+
def fs_ls(self, src):
cmd = (
"import uos\nfor f in uos.ilistdir(%s):\n"