diff --git a/devlib/target.py b/devlib/target.py index ac92dc9..7996255 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -585,6 +585,9 @@ class Target(object): # files + def makedirs(self, path): + self.execute('mkdir -p {}'.format(quote(folder))) + def file_exists(self, filepath): command = 'if [ -e {} ]; then echo 1; else echo 0; fi' output = self.execute(command.format(quote(filepath)), as_root=self.is_rooted) diff --git a/doc/target.rst b/doc/target.rst index 7f108e6..a7c894e 100644 --- a/doc/target.rst +++ b/doc/target.rst @@ -436,6 +436,10 @@ Target Return a list of :class:`PsEntry` instances for all running processes on the system. +.. method:: Target.makedirs(self, path) + + Create a directory at the given path and all its ancestors if needed. + .. method:: Target.file_exists(self, filepath) Returns ``True`` if the specified path exists on the target and ``False``