Jump to content

DirCopy Help


Recommended Posts

Hi Guys,

So im located in Australia and at work we have a network connecting to our America systems. now when i try to do a DirCopy to copy a folder from the American network to our network so that its easier for the Australian guys to work on (connection is slow between countries) the script doesnt fail, it just runs however doesn't seem to finish or do anything.

Ive got the links correct as i can just copy and paste into explorer and it will open the folders however when automating autoit doesnt seem to want to do anything.

Any ideas, suggestions?

Link to comment
Share on other sites

#include <FileConstants.au3>


DirCopy("\\calypsofsv1.corporate.libgo\CalypsoFS\FCGP US Product Contracts\2014 FCGP Contracting","\\fbnecl3\inzb\Documents\Global Support\USA 2014 Drive",$FC_OVERWRITE)


msgbox(0,"USA DRIVE COPY", "Complete")
have also tried , 1 instead of $FC_OVERWRITE
Edited by 13lack13lade
Link to comment
Share on other sites

I tried using filecopy on one of the files in the folder and it copied over successfully... could it simply be that due to it being a slow connection it will take a long time to copy all the files over?

40kb file took 4.2 seconds to copy... is there a way to speed up the process or nay?

Edited by 13lack13lade
Link to comment
Share on other sites

Good Afternoon 13lack13lade,

I copied and pasted your script but changed both the source and destination. I was able to get it to work however it was just a small text file within a folder that I copied. Try this as it may help with any errors:

 
#include <FileConstants.au3>
 
If FileExists("fbnecl3\inzb\Documents\Global Support\USA 2014 Drive\") Then
MsgBox(0, "", "File exists")
Else
DirCopy("\\calypsofsv1.corporate.libgo\CalypsoFS\FCGP US Product Contracts\2014 FCGP Contracting", "\\fbnecl3\inzb\Documents\Global Support\USA 2014 Drive", $FC_OVERWRITE)
EndIf
 
If FileExists("\\fbnecl3\inzb\Documents\Global Support\USA 2014 Drive") Then
msgbox(0,"USA DRIVE COPY", "Complete")
Else
msgbox(0,"", @error)
EndIf
 

Also make sure that both calypsofsv1.corporate.libgo and fbnec13 can be resolved by name and that whomever is running this has the modify permissions to each of these locations. Hope this helps!

Edited by grimmlock

Thanks

Grimm

Link to comment
Share on other sites

  • Moderators

If you're operating over a slow link, you may want to put a check in place. Do a DirGetSize on the folder before copying, and a sleep until the DirGetSize matches on the destination computer.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

DirCopy is a blocking function, it won't return to the script until it's done copying everyting.

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 Gude
How 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

  • Moderators

I forgot about that, thanks for the correction. Perhaps over a slow link it would be better to enum the files in the directory, then create your structure locally and copy individually, error checking after each.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

It's not blocking if you run it like this :)

Run(@AutoItExe & ' /AutoIt3ExecuteLine  "dircopy()"')

of course, you need to add in the params.

You can then get the PID, and perform a counter, or check the dir dest size vs dir get size.

Example with params, and loop...(assumes dest dir is 0kb):

$iSource = DirGetSize("J:\dom\r10_0\builds\B436")
$iPid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "dircopy(""J:\somedir\domedir"",@DesktopDir & ""\Test2"",1)"')

While ProcessExists($iPid)
    ConsoleWrite (Round(100*(DirGetSize(@DesktopDir & "\Test2")/$iSource),2) & @CRLF)
    Sleep (500)
WEnd
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...