#!/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 | |
---|---|---|---|---|---|
#3 | 27331 | tom_tyler |
Released SDP 2020.1.27325 (2021/01/29). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#2 | 26161 | tom_tyler |
Released SDP 2019.3.26159 (2019/11/06). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
#1 | 21338 | tom_tyler |
Released SDP 2016.2.21328 (2016/12/16). Copy Up using 'p4 copy -r -b perforce_software-sdp-dev'. |
||
//guest/perforce_software/sdp/dev/Maintenance/lowertree.py | |||||
#1 | 21302 | russell_jackson | Script to lower case a tree. |