Husel Posted July 30, 2009 Share Posted July 30, 2009 Hi everybody, I just recently discovered AutoIt and am impressed. It seems to be one of the programs I was looking for a long time. Just an up to date version of .bat files. However, I encountered a problem when wirting my own first little script. My problem: I have some files named cond1111.txt, cond1112.txt, cond1121.txt, ..., cond1242.txt. What I basically want to do is rename those file to cond2111.txt, cond2112.txt, ..., cond2242.txt. This is, cange the first 1 to a 2. Therefore I wrote a little script posted below that, in my eyes, should accomplish this. But somehow it does not. For $i = 1 To 2 For $f = 1 To 4 For $g = 1 to 2 $nameold = "cond1" & $i & $f & $g & ".txt" $namenew = "\cond2" & $i & $f & $g & ".txt" FileMove(@ScriptDir & $nameold, @ScriptDir & $namenew) Next Next Next I checked the variables $nameold and $namenew and they contain what they are supposed to (e.g., cond1111.txt or /cond2111.txt). I already tried to construct the filenames within in the FileMove function, but this did not work either. Can anybody tell me, what I am doing wrong. It wouzld be so great, because I would realy like to use AutoIt regularly. Thanks from Germany, Henrik Link to comment Share on other sites More sharing options...
Robjong Posted July 30, 2009 Share Posted July 30, 2009 Looks like you forgot to put a backslash infront of the filename for $nameold $nameold = "cond1" & $i & $f & $g & ".txt" so it should be this $nameold = "\cond1" & $i & $f & $g & ".txt" Link to comment Share on other sites More sharing options...
Husel Posted July 31, 2009 Author Share Posted July 31, 2009 Thanks a lot. I dont know why i did not try THIS. Now everything is fine. Sorry for disturbing you. Thanks. 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