shEiD Posted August 25, 2010 Share Posted August 25, 2010 (edited) Hi, I just spent 2 hours looking for a bug in my script, until finally I realized, that the bug is in AutoIt's DirMove() itself, it seems...Example:Example() Func Example() DirCreate('C:\DirMove.Test\Destination') DirCreate('C:\DirMove.Test\Flag.None') DirCreate('C:\DirMove.Test\Flag.0') DirCreate('C:\DirMove.Test\Flag.1') Sleep(1500) DirMove('C:\DirMove.Test\Flag.None', 'C:\DirMove.Test\Destination') DirMove('C:\DirMove.Test\Flag.0', 'C:\DirMove.Test\Destination', 0) DirMove('C:\DirMove.Test\Flag.1', 'C:\DirMove.Test\Destination', 1) EndFunc ;==>Example ExitThe only folder that gets moved is Flag.1. No flag or flag=0 does not work and returns 0.Please confirm.Thanks in advance. Edited August 25, 2010 by shEiD Link to comment Share on other sites More sharing options...
somdcomputerguy Posted August 25, 2010 Share Posted August 25, 2010 (edited) From the Helpfile:Flag: 0 = (default) do not overwrite existing filesFrom your code:DirCreate('C:\DirMove.Test\Destination')DirCreate('C:\DirMove.Test\Flag.None')DirCreate('C:\DirMove.Test\Flag.0')DirCreate('C:\DirMove.Test\Flag.1') Edited August 25, 2010 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
shEiD Posted August 25, 2010 Author Share Posted August 25, 2010 (edited) @somdcomputerguy Huh? I don't get it, what did you mean by that? What it has to do with overwriting and creating folder (your qoute of my code).There is no overwriting needed in the example.Anyway, DirMove is pretty weird or f***ed up - even more bugs?:Examples:Example2() Example3() Func Example2() DirCreate('C:\DirMove.Test.2\Flag.1') FileWriteLine('C:\DirMove.Test.2\Flag.1\test.txt', 'test') Sleep(1500) DirMove('C:\DirMove.Test.2\Flag.1', 'C:\DirMove.Test.2\Destination', 1) EndFunc ;==>Example Func Example3() DirCreate('C:\DirMove.Test.3\Destination') DirCreate('C:\DirMove.Test.3\Flag.1') FileWriteLine('C:\DirMove.Test.3\Flag.1\test.txt', 'test') Sleep(1500) DirMove('C:\DirMove.Test.3\Flag.1', 'C:\DirMove.Test.3\Destination', 1) EndFunc ;==>Example ExitExample 2: file gets moved to "C:\DirMove.Test.2\Destination" (what the hell?)Example 3: file gets moved to "C:\DirMove.Test.3\Destination\Flag.1" (ok)It seems, if destination directory does not exist, weird s**t happens Edit: nevermind, just read help file again, and I gather in the Example2 DirMove() behaves like DirRename (which is not present in AutoIt). Confusing... But what with the flags 0/ no flag not working, I still don't get it... Edited August 25, 2010 by shEiD Link to comment Share on other sites More sharing options...
Tvern Posted August 25, 2010 Share Posted August 25, 2010 (edited) You need to specify the full path you want to move the folder to, including the name you want the folder to have in the new location. for example: DirMove("C:\SomeFolder\MoveFolder", "C:\SomeOtherFolder") would rename "MoveFolder" to "SomeOtherFolder" which is created in "C:\". To Move the folder inside the other folder use: DirMove("C:\SomeFolder\MoveFolder", "C:\SomeOtherFolder\MoveFolder") Edit: Too late Edited August 25, 2010 by Tvern Link to comment Share on other sites More sharing options...
shEiD Posted August 25, 2010 Author Share Posted August 25, 2010 (edited) @Tvern Thanks anyway About example in the first post: Help file for DirMove says:[optional] this flag determines whether to overwrite files if they already existOr should I understand that DirMove does not overwrite folders if they exist aswell, not only files? If this is the case then help file needs clarification. Edited August 25, 2010 by shEiD 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