Jump to content
Monica

Copy a directory using WinAPIEx function

Recommended Posts

Monica

Hi Guys!

I'm trying to copy a folder from location A to location B. The DirCopy embedded function works great, but if the folder is large, my little program freeze, so that the user doesn't understand what's going on. I've found many solutions in this forum, but not for me.

So... All I want to do is delegate to someone the folder copy process... To Windows, obviously! :D

The API is a good solution I found... _WinAPI_CopyFileEx works like a charm, but it is for files only! :( I tried to insert a folder (with or without final /), but fails.

Is there an API functions for me? Please... help me!

:)

Reg.

Monica

PS

Attached code from help (_WinAPI_CopyFileEx)

 

prova.au3

Share this post


Link to post
Share on other sites
Danyfirex

¿Why no use _WinAPI_ShellFileOperation or IFileOperation?

 

Saludos

Share this post


Link to post
Share on other sites
Monica

Thanks guys! I'll try and report here the result.

:)

Reg.

Monica

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

  • Similar Content

    • MovieScreener2013
      By MovieScreener2013
      OK I have a snip-it of code that worked fine until I attempted to use it in my main script.
      I have determined that the issues are from permissions and I am looking to see if there is an option for DirCopy to allow it to respond yes to any prompts since I have already setup everything around DirCopy it would save me a bit of time.
      Here is the snip-it:
      Func _Dir_Copy_Progress($sSourceFolder, $sDestFolder)
          Local $ipct
          DirRemove($sDestFolder, 1)
          Local $iSourceSize = DirGetSize($sSourceFolder), $iDestSize
          Local $pid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "DirCopy(''' & $sSourceFolder & ''', ''' & $sDestFolder & ''')"')
          ProgressOn("Copy Progress", "Please Wait...")
          Do
              $iDestSize = DirGetSize($sDestFolder)
              $ipct = Int(($iDestSize / $iSourceSize) * 100)
              ProgressSet($ipct, $ipct & ' percent complete')
              Sleep(20)
          Until Not ProcessExists($pid)
          ProgressOff()
      EndFunc   ;==>_Dir_Copy_Progress
       
      Since I have determined that this is a local windows client issue I am tempted to just create a function to take ownership of the local directory so that it doesn't prompt but was looking for the most efficient path first. 
       
      Thanks for any assistance... 
    • Gringo
      By Gringo
      Hi,
      I'd like to do simple copy of a directory reading an ini for the path.
      I'm pretty sure it's not a big deal but for a noob like me... Well I'm looking for a solution since 2 hours now
       
      #include <MsgBoxConstants.au3> $dircp = IniRead("path.ini", "Path", "path", " ERROR") MsgBox($MB_SYSTEMMODAL, "", "path is: : " & $dircp) DirCopy ("Guideone", $dircp) The value returned by iniread is correct, but the dircopy does nothing,
       
      Any idea?
    • argumentum
      By argumentum
      in 
       so, here they are.
    • Progh0st
      By Progh0st
      This peace of code does not work. I'm trying to copy all my usb files to desktop. What is wrong with it?
      DirCopy("E:", @DesktopDir & "\Backups\MyWork", $FC_OVERWRITE) ;Tried also this, not working. DirCopy("E:\", @DesktopDir & "\Backups\MyWork\", $FC_OVERWRITE)  
    • gillesg
      By gillesg
      Hi all,
      I need to make a dircopy function that correctly handle symlink and junction without duplicating files and folder.
      Let's try to be more precise
      I have the following directory structure 
      My folder---+ | |-- Local.file (regular file) |-- local folder (regular folder) |-- Target.symlink (symlink to file Local.file) |-- target.folder.symlink (symlink to folder local.folder) |-- target.folder.junction (junction to folder D:\PAC_Launchers\test\local.folder) 22/03/2016 21:42 10 Local.file 22/03/2016 21:41 <REP> local.folder 22/03/2016 21:42 11 Target.file 22/03/2016 21:40 <REP> Target.folder 22/03/2016 15:16 <JONCTION> target.folder.junction [D:\PAC_Launchers\test\local.folder] 22/03/2016 15:15 <SYMLINKD> target.folder.symlink [local.folder] 22/03/2016 07:42 <SYMLINK> Target.symlink [Local.file] To do so, i need to be able to identify that a file or a folder is a Symlink or Junction. And in that case I need to know the target of the symlink or junction.
      Does any of you have an idea or a script to do so.
      Gilles
       
×