]> gitweb.michael.orlitzky.com - dead/census-tools.git/blob - src/FileUtils.py
2b89adf35365e589ef405e41dbcf3935d17222a0
[dead/census-tools.git] / src / FileUtils.py
1 """
2 Utility functions for working with the filesystem, generally modeled
3 after useful shell commands.
4 """
5
6 import os
7
8
9 def rm_f(path):
10 """
11 Remove (unlink) a file, ignoring any exceptions that may be
12 thrown.
13 """
14 try:
15 os.remove(path)
16 except:
17 pass
18
19
20 def mkdir_p(path, mode):
21 """
22 Create a directory hierarchy, ignoring any exceptions that may be
23 thrown.
24 """
25 try:
26 os.makedirs(path, mode)
27 except:
28 pass
29