Sign in to follow this  
Followers 0
aslani

DirMove() and FileMove()

8 posts in this topic

Ok sift thru the search already and nada.

Basically, we get our work from a network directory and we move that folder into our desktop and start on working on the contents. I made a program that assists on the work load in the folder and it will be really helpful to add a function that automatically moves the folder into the desktop, but using either of the move function doesn't seems to work. Here's what I have.

Case $msg = $k_mECO
    $g_kECO = GUICtrlRead($k_eco)
    If FileExists("N:\Temp\" & $g_kECO) Then
        DirMove("N:\Temp\" & $g_kECO, @DesktopDir)
    Else
        MsgBox(0, $g_kECO, $g_kECO & " not found!")
    EndIf
    If FileExists(@DesktopDir & "\" & $g_kECO) Then
        MsgBox(0, $g_kECO, $g_kECO & " move was a success!")
    Else
        MsgBox(0, $g_kECO, $g_kECO & " move failed!")
    EndIf

$g_kECO is the folder name.

Any help is appreciated.


[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

Share this post


Link to post
Share on other sites



If its a network share, I take it is a networked computer?

Try using the actual computer name instead.

\\PCNAME\TEMP\....

Also, make sure there is no trailing backslash on the source, or destination.

Cheers,

Brett

Share this post


Link to post
Share on other sites

Try FileCreateShortcut(). If the drive is mapped then that should work and even if it doesn't move it should have more or less the same effect. ;)

Share this post


Link to post
Share on other sites

Mapping a drive with autoit seems to be a problem for everyone. There are a lot of threads regarding this matter, maybe if you search you'll find a solution.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Mapping a drive with autoit seems to be a problem for everyone.

News to me. Our logon-scripts rely on DriveMapAdd(), and that's numerous logons daily. Problems are rare. We do still use the 3.1 compiler mind you. Has the probem arisen with later compilers?

The issue with UNC paths is that they create a 'nail-down' situation in which the network admin cannot/dare not reorganise data on the servers, for fear of breaking undocumented links to it. Basically they are another of those Bad Ideas which I suppose seemed good to the MS techs at the time. Drive mappings (especially when established by a logon script) are free from this problem, though they do suffer clashes with those USB multi-cardreaders which allocate a whole bank of letters for no good reason.

To the OP: an issue to watch is that you cannot remap a letter under WinXP without first deleting it. Might this be your problem?

Edited by Anteaus

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

DirMove()

Remarks

If the destination already exists and the overwrite flag is specified then the source directory will be moved inside the destination.

@DesktopDir directory already exists so you need to add flag 1. After your script finish moving the folder over to the desktop press F5 to refresh the screen.

DirMove("N:\Temp\" & $g_kECO, @DesktopDir , 1)

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

DirMove()

Remarks

If the destination already exists and the overwrite flag is specified then the source directory will be moved inside the destination.

@DesktopDir directory already exists so you need to add flag 1. After your script finish moving the folder over to the desktop press F5 to refresh the screen.

DirMove("N:\Temp\" & $g_kECO, @DesktopDir , 1)

Oh wow, that work.

I misunderstood the "if the destination already exist" thinking that if the folder I'm transfering is already in the destination that's why I didn't flag it.

Thank you. ;)

EDIT:

Ok, it worked but it dumps everything on the Desktop rather than inside the folder.

Example:

Folder_1

- File_1

- File_2

After DirMove(), it looks like this;

Desktop

- Folder_1

- File_1

- File_2

Instead of;

Desktop

- Folder_1

-- File_1

-- File_2

Any suggestion?

EDIT 2:

nvm I figured it out, it came to me as I was typing the first edit.

DirMove("N:\Temp\" & $g_kECO, @DesktopDir & "\" & $g_kECO, 1)

Thank you all for you help.

Edited by aslani

[font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version

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