#!/usr/bin/env python2 #!/usr/bin/python # ============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE # ------------------------------------------------------------------------------ # Usage: # This script is used to rename a tree to all lowercase. It is helpful if you are # trying to convert your server from case sensitive to case insensitive. # # It takes the directory to convert as the first parameter. import sys, os def rename_dir(directory): # rename current directory if needed try: os.rename(directory, directory.lower()) except: print("Rename of %s failed." % directory) directory = directory.lower() # rename children for fn in os.listdir(directory): path = os.path.join(directory, fn) lowpath = path.lower() try: if (path != lowpath): print("Renaming %s" % path) os.rename(path, lowpath) except: print("Rename of %s failed." % path) path = lowpath # rename children within, if this child is a directory if os.path.isdir(path): rename_dir(path) ############################################################################### if __name__ == '__main__': if len(sys.argv) <= 1: print("Read the usage section at the top of the script for required parameters.") sys.exit(1) rename_dir(sys.argv[1])
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 24675 | Russell C. Jackson (Rusty) |
Fixed bugs in sdputils.py and scripts using it. Converted to standard 2 space spacing, removed copyright stuff. |
||
#1 | 22693 | Russell C. Jackson (Rusty) |
Branched a Unix only version of the SDP. Removed extra items to create a cleaner tree. Moved a few items around to make more sense without Windows in the mix. |
||
//guest/perforce_software/sdp/dev/Maintenance/lowertree.py | |||||
#1 | 21302 | Russell C. Jackson (Rusty) | Script to lower case a tree. |