summaryrefslogtreecommitdiff
path: root/file_ops.py
diff options
context:
space:
mode:
Diffstat (limited to 'file_ops.py')
-rw-r--r--file_ops.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/file_ops.py b/file_ops.py
index b9b3f6f..b482b88 100644
--- a/file_ops.py
+++ b/file_ops.py
@@ -237,3 +237,16 @@ def get_file_size(path):
if (is_file(path) == False):
return 0
return os.path.getsize(get_path_str(path))
+
+# function to rename a folder or a file
+def rename(current_name, new_name):
+ # check params
+ if (f_exists(current_name) == False
+ or f_exists(new_name) == True):
+ return False
+ # reformat the strings
+ current_name = get_path_str(current_name)
+ new_name = get_path_str(new_name)
+ #call os.rename()
+ os.rename(current_name, new_name)
+ return True