diff options
author | toonn <toonn@toonn.io> | 2020-07-05 15:01:32 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2020-07-05 15:01:32 +0200 |
commit | aff694730d3df63778923e3f59cc77ff58c9235a (patch) | |
tree | 4750035c5337daebdf2e79117d783f15e32e98e6 | |
parent | 74bb51835f50393c38a9ba9aaef9cfc978f30ba8 (diff) | |
parent | c2ae8e63f953dd1122653fdbf3048b7b7980b396 (diff) | |
download | ranger-aff694730d3df63778923e3f59cc77ff58c9235a.tar.gz |
Merge branch 'touch-recursive'
-rwxr-xr-x | ranger/config/commands.py | 6 |
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) |