diff options
author | kennyballou <kballou@onyx.boisestate.edu> | 2012-10-23 01:06:13 -0600 |
---|---|---|
committer | kballou <kballou@onyx.boisestate.edu> | 2012-10-23 01:06:13 -0600 |
commit | 011df06c43c9d0821509ee5f3d3b2a3506794b93 (patch) | |
tree | 083dd00e7a970d75deffd4261660834a08ba8e81 /xnt/tasks.py | |
parent | a6a1758af6339d82d6f2d6e786c206e98e0f982b (diff) | |
download | xnt-011df06c43c9d0821509ee5f3d3b2a3506794b93.tar.gz xnt-011df06c43c9d0821509ee5f3d3b2a3506794b93.tar.xz |
Add "fileset" functionality to tasks.rm method
xnt.tasks.rm method is now able to delete an arbitrary number of files and
folders as given by the ``fileset`` property
Diffstat (limited to 'xnt/tasks.py')
-rw-r--r-- | xnt/tasks.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/xnt/tasks.py b/xnt/tasks.py index 82b46d3..bed6745 100644 --- a/xnt/tasks.py +++ b/xnt/tasks.py @@ -32,13 +32,14 @@ def mkdir(dir,mode=0o777): except: raise -def rm(path): - logger.info("Removing %s", path) +def rm(*fileset): try: - if os.path.isdir(path): - shutil.rmtree(path) - else: - os.remove(path) + for f in fileset: + logger.info("Removing %s", f) + if os.path.isdir(f): + shutil.rmtree(f) + else: + os.remove(f) except OSError: pass except: |