about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2020-07-05 15:01:32 +0200
committertoonn <toonn@toonn.io>2020-07-05 15:01:32 +0200
commitaff694730d3df63778923e3f59cc77ff58c9235a (patch)
tree4750035c5337daebdf2e79117d783f15e32e98e6
parent74bb51835f50393c38a9ba9aaef9cfc978f30ba8 (diff)
parentc2ae8e63f953dd1122653fdbf3048b7b7980b396 (diff)
downloadranger-aff694730d3df63778923e3f59cc77ff58c9235a.tar.gz
Merge branch 'touch-recursive'
-rwxr-xr-xranger/config/commands.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 2656755e..27919541 100755
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -927,10 +927,14 @@ class touch(Command):
     """
 
     def execute(self):
-        from os.path import join, expanduser, lexists
+        from os.path import join, expanduser, lexists, dirname
+        from os import makedirs
 
         fname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
+        dirname = dirname(fname)
         if not lexists(fname):
+            if not lexists(dirname):
+                makedirs(dirname)
             open(fname, 'a').close()
         else:
             self.fm.notify("file/directory exists!", bad=True)