Sign in to follow this  
Followers 0
blitzkrg

Proper case and Dirmove

5 posts in this topic

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?

Share this post


Link to post
Share on other sites



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

[center]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.[/center]

Share this post


Link to post
Share on other sites

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!!

Share this post


Link to post
Share on other sites

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
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)

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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 :lmao: ... I can't tell you how many times I forget that 'StringIsLower' is even there!!

[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0