NicePerson Posted March 29, 2011 Share Posted March 29, 2011 Here is the script: DirMove(@ScriptDir&"\New Folder", @ScriptDir&"\1-36-26 PM, 29 March, 2011") Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 29, 2011 Moderators Share Posted March 29, 2011 NicePerson, Works fine for me. Can you rename the folder manually? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
NicePerson Posted March 29, 2011 Author Share Posted March 29, 2011 Yes, i can rename manually.. Link to comment Share on other sites More sharing options...
Tvern Posted March 29, 2011 Share Posted March 29, 2011 I can think of a few reasons, in order from most, to least probable: Is this script in a folder? There seems to be a bug with @ScriptDir where it will add a trailing "\" when it is run from the root of a drive, while it doesn't when it is in a folder. This can result in invalid filepaths. Try this to see if the filepaths are correct. ConsoleWrite(@ScriptDir&"\New Folder" & @CRLF & @ScriptDir & "\1-36-26 PM, 29 March, 2011" & @CRLF) Try adding #RequireAdmin to your script, so you will have the proper rights to change the folder. Just to make sure it's not a problem with the name. (path being too long for instance) try renaming to something simple to see if that works. I had another suggestion, but I forgot it while writing this. Link to comment Share on other sites More sharing options...
NicePerson Posted March 29, 2011 Author Share Posted March 29, 2011 Path seems to be correct: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\AutoIt\DirMove.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>15:51:08 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X86 OS:X86) >Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3 +>15:51:08 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "E:\AutoIt\DirMove.au3" E:\AutoIt\New Folder E:\AutoIt\1-36-26 PM, 29 March, 2011 +>15:51:09 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 3.462 I also tried #RequireAdmin but not worked.. Link to comment Share on other sites More sharing options...
Tvern Posted March 29, 2011 Share Posted March 29, 2011 Then I don't know, unless it's something silly, like (a file in) the folder being in use, a folder with the destination name already existing, or an incorrect source path, I wouldn't know what could cause this to fail. A test on my machine with the exect same path worked flawlessly. Link to comment Share on other sites More sharing options...
ripdad Posted March 29, 2011 Share Posted March 29, 2011 (edited) Another possibility .. You cannot move or rename a folder, if a file is in use from that same folder. - edit- oops, Tvern said it too. Edited March 29, 2011 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
NicePerson Posted March 29, 2011 Author Share Posted March 29, 2011 (edited) Edited March 29, 2011 by NicePerson Link to comment Share on other sites More sharing options...
Bowmore Posted March 29, 2011 Share Posted March 29, 2011 If you want to continue receiving help around here I would advice you to edit your last post to something less hot headed. Posts like that are not appreciated. Try and be the NicePerson you claim to be. There is nothing wrong with DirMove() so it has to be one of the access permission issues on your PC that other have suggested. Run this and post the output. $result = DirCreate(@ScriptDir&"\New Folder") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result& @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $result = DirMove(@ScriptDir&"\New Folder", @ScriptDir&"\1-36-26 PM, 29 March, 2011",1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result= ' & $result& @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $result = FileExists (@ScriptDir&"\1-36-26 PM, 29 March, 2011") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
SilentBob999 Posted September 15, 2011 Share Posted September 15, 2011 (edited) If you want to continue receiving help around here I would advice you to edit your last post to something less hot headed. Posts like that are not appreciated. Try and be the NicePerson you claim to be. There is nothing wrong with DirMove() so it has to be one of the access permission issues on your PC that other have suggested. Run this and post the output. $result = DirCreate(@ScriptDir&"\New Folder") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result& @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $result = DirMove(@ScriptDir&"\New Folder", @ScriptDir&"\1-36-26 PM, 29 March, 2011",1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result= ' & $result& @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console $result = FileExists (@ScriptDir&"\1-36-26 PM, 29 March, 2011") ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console Hi, I have to say that there definitly a bug in dirmove.. Running that give these return : @@ Debug(55) : $result = 1 >Error code: 0 @@ Debug(58) : $result= 1 >Error code: 0 @@ Debug(61) : $result = 1 >Error code: 0 Thats normal.. But running it multiple time give this result in folder: 1-36-26 PM, 29 March, 2011\New Folder\New Folder (The last "New Folder" should not exist right !?!) is there something I dont understand ?? Edited September 15, 2011 by SilentBob999 Link to comment Share on other sites More sharing options...
BrewManNH Posted September 15, 2011 Share Posted September 15, 2011 What's happening is that it's moving "New Folder" into the "1-36-26 PM, 29 March, 2011" folder, because that's what the code is telling it to do. The first time you ran it, that folder didn't exist, so it renamed "New Folder" to "1-36-26 PM, 29 March, 2011", the second time, it sees the "1-36-26 PM, 29 March, 2011" folder and moves "New Folder" into it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
SilentBob999 Posted September 15, 2011 Share Posted September 15, 2011 (edited) What's happening is that it's moving "New Folder" into the "1-36-26 PM, 29 March, 2011" folder, because that's what the code is telling it to do. The first time you ran it, that folder didn't exist, so it renamed "New Folder" to "1-36-26 PM, 29 March, 2011", the second time, it sees the "1-36-26 PM, 29 March, 2011" folder and moves "New Folder" into it. yes but we should only get "1-36-26 PM, 29 March, 2011\New Folder" Not "1-36-26 PM, 29 March, 2011\New Folder\New Folder" The overwrite doesnt work and it move the folder inside a "same named" folder instead.. $DirToMove1 = @ScriptDir & "\DirMoveTest\DirToMove1" $DirToMove2 = @ScriptDir & "\DirMoveTest\DirToOverwrite" $DirToOverwrite = @ScriptDir & "\DirMoveTest\Result\DirToOverwrite" $ResultFolder = @ScriptDir & "\DirMoveTest\Result" DirCreate ($DirToMove1) FileWriteLine($DirToMove1 & "\File1.txt", "test") DirCreate ($DirToMove2) FileWriteLine($DirToMove2 & "\File2.txt", "test") DirCreate ($DirToOverwrite) DirMove ($DirToMove1, $ResultFolder,1) DirMove ($DirToMove2, $ResultFolder,1) with this example I should get as Result : File1.txt in @ScriptDir & "\DirMoveTest\Result\DirToMove1 and File2.txt in @ScriptDir & "\DirMoveTest\Result\DirToOverwrite Instead I get File2.txt in @ScriptDir & "\DirMoveTest\Result\DirToOverwrite\DirToOverwrite And with the same example, if we use flag 0 then it move nothing.. Edited September 15, 2011 by SilentBob999 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