blitzkrg Posted January 12, 2006 Share Posted January 12, 2006 I have allot of folder that i want to rename to proper case c:\test should be c:\Test c:\this is a test should be c:\This is a test i was going to use _stringproper and then dirmove to rename the folders but since there are soo many of them (hundreds) i dont want all the moving activity to take place if the folder is already the proper case I was going to use StringisLower and just see if they were all lower case and then rename based on that condition, BUT StringisLower reports 0 if there are spaces in the string (i.e. c:\this is a test) so it wont work. any other ideas? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 12, 2006 Moderators Share Posted January 12, 2006 I assume you already have your recursive file search done, and you know how to get the string for your file name... this is just an example, but you can mod it to fit what you need, and only change the file name while the DirMove() is going on if it is not proper. Dim $String[3] $String[1] = 'C:\gbc' $String[2] = 'C:\Gbc' For $i = 1 To UBound($String) - 1 Local $FindString = StringLeft(StringTrimLeft($String[$i], StringInStr($String[$i], '\')), 1) If Asc($FindString) >= Asc('a') And $FindString <= Asc('z') Then MsgBox(0, 'Test', 'String ' & $i & ' name does not start with a proper A to Z') Else MsgBox(0, 'Test', 'String ' & $i & ' name does start with a proper A to Z') EndIf Next Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
blitzkrg Posted January 12, 2006 Author Share Posted January 12, 2006 I assume you already have your recursive file search done, and you know how to get the string for your file name... this is just an example, but you can mod it to fit what you need, and only change the file name while the DirMove() is going on if it is not proper. Dim $String[3] $String[1] = 'C:\gbc' $String[2] = 'C:\Gbc' For $i = 1 To UBound($String) - 1 Local $FindString = StringLeft(StringTrimLeft($String[$i], StringInStr($String[$i], '\')), 1) If Asc($FindString) >= Asc('a') And $FindString <= Asc('z') Then MsgBox(0, 'Test', 'String ' & $i & ' name does not start with a proper A to Z') Else MsgBox(0, 'Test', 'String ' & $i & ' name does start with a proper A to Z') EndIf Next I think i can make that work. Thanks!! Link to comment Share on other sites More sharing options...
seandisanti Posted January 12, 2006 Share Posted January 12, 2006 I assume you already have your recursive file search done, and you know how to get the string for your file name... this is just an example, but you can mod it to fit what you need, and only change the file name while the DirMove() is going on if it is not proper. Dim $String[3] $String[1] = 'C:\gbc' $String[2] = 'C:\Gbc' For $i = 1 To UBound($String) - 1 Local $FindString = StringLeft(StringTrimLeft($String[$i], StringInStr($String[$i], '\')), 1) If Asc($FindString) >= Asc('a') And $FindString <= Asc('z') Then MsgBox(0, 'Test', 'String ' & $i & ' name does not start with a proper A to Z') Else MsgBox(0, 'Test', 'String ' & $i & ' name does start with a proper A to Z') EndIf NextOR you could just do a single line check and replace... If StringIsLower(StringLeft($dirname,1)) Then $dirname = StringUpper(StringLeft($dirname,1)) & StringRight($dirname,StringLen($dirname)-1) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 12, 2006 Moderators Share Posted January 12, 2006 OR you could just do a single line check and replace... If StringIsLower(StringLeft($dirname,1)) Then $dirname = StringUpper(StringLeft($dirname,1)) & StringRight($dirname,StringLen($dirname)-1) Dammit ... I can't tell you how many times I forget that 'StringIsLower' is even there!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now