from java.io import File def setup(): # rename local file sketchfile = rename(sketchPath("input.txt"), sketchPath("output.txt")) # rename local folder sketchfold = rename(sketchPath("docs"), sketchPath("mydocs")) # rename root file (if permitted) rootfile = rename("input.txt", "output.txt") # rename root folder (if permitted) rootfold = rename("docs", "mydocs") # display results of four operations: True=success, False=fail println(str(sketchfile) + ' ' + str(sketchfold) + ' ' + str(rootfile) + ' ' + str(rootfold)) # output: # True True False False def rename(oldname, newname): # File (or directory) with old name file = File(oldname) # File (or directory) with new name file2 = File(newname) # Rename file (or directory) success = file.renameTo(file2) return success