Created
August 29, 2012 09:14
-
-
Save mresetar/3508904 to your computer and use it in GitHub Desktop.
Creates longest possible dir name for windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#maxpath | |
def dirName = 'd:\\tmp\\' | |
def MAX_PATH = 260 | |
def FILE_NAME = 12 | |
def NULL_SIZE = 1 | |
def i = dirName.length() | |
while (i < MAX_PATH - FILE_NAME - NULL_SIZE) { | |
def iLen = (i as String).length() | |
def currLenValue = i + iLen | |
def rest = currLenValue % 10 | |
if (rest == 0) { dirName += currLenValue; i += (currLenValue as String).length() } | |
else {dirName += 'a'; i++} | |
} | |
println dirName.length() | |
println dirName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment