Commit b068c76c authored by Roland Haas's avatar Roland Haas
Browse files

showcase_helper: show how to rename or move a file

parent b3581006
......@@ -36,9 +36,20 @@ with open(houndfile, "r") as fh:
print("Hounds contains:", fh.readlines())
print("done")
# rename file (can also move files using this)
kenneldir = "%s/%s-kennel" % (os.getcwd(), os.environ["USER"])
kennel_houndfile = os.path.join(kenneldir, os.path.split(houndfile)[-1])
kennel_foxfile = os.path.join(kenneldir, os.path.split(foxfile)[-1])
print("Moving %s, and %s into %s" % (foxfile,houndfile,kenneldir))
os.mkdir(kenneldir)
helper.rename(globushl.EP_BLUEWATERS, houndfile, kennel_houndfile)
helper.rename(globushl.EP_BLUEWATERS, foxfile, kennel_foxfile)
files = helper.ls(globushl.EP_BLUEWATERS, kenneldir)
print(list(files.keys()))
# get rid of files
print("Removing files")
helper.delete(globushl.EP_NEARLINE, nearline_foxfile)
helper.delete(globushl.EP_BLUEWATERS, [foxfile, houndfile, harefile])
delete1 = helper.delete(globushl.EP_NEARLINE, nearline_foxfile)
delete2 = helper.delete(globushl.EP_BLUEWATERS, [harefile, kenneldir], recursive=True)
print("All done")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment