Jump to content
Sign in to follow this  
hendrikhe

DirCopy OneDrive Folder is not working

Recommended Posts

Hello,

I am having issues copying OneDrive Folder.  With the script below, it simple copies nothing. Nothing happens, no error message.

Working with other "normal" folders. Is the OneDrive Folder special?


DirCopy("C:\Users\Test\OneDrive\", "D:\new",1)

Share this post


Link to post
Share on other sites

Hi.

Helpfile says: source dir = Path of the source directory (with no trailing backslash). e.g. "C:\Path1"

Maybe you have to script:

DirCopy("C:\Users\Test\OneDrive", "D:\new",1)

Conrad


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites

Is OneDrive on C: really a directory or could it be a shortcut?

What is the result if you try this:

ConsoleWrite(FileGetAttrib("C:\Users\Test\OneDrive") & @CRLF)

 


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites

Just run the line and look what is written in the console window beneath.


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Test\Desktop\move.au3" /UserParams    
+>13:47:59 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00000416  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0407)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\Test\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\Hiss\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\Test\Desktop\move.au3
+>13:47:59 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Test\Desktop\move.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
RD
+>13:47:59 AutoIt3.exe ended.rc:0
+>13:47:59 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.7716

Edited by hendrikhe

Share this post


Link to post
Share on other sites

Hello @hendrikhe,

Try this:

$result = DirCopy("C:\Users\Test\OneDrive", "D:\new")

if $result = 1 then msgbox("","OK", "DirCopy function worked")

if $result = 0 then msgbox("","error", "DirCopy function report failure")

 

Edited by Neutro

Share this post


Link to post
Share on other sites

What @Neutro means:

ConsoleWrite(DirCopy("C:\Users\Test\OneDrive", "D:\new",1) & @CRLF)

FileGetAttrib says "RD" in console output. D means directory what is correct. R means read only. My directories normally don't have the attribute read only.

Maybe that's the reason? You are not allowed to copy this directory?

Can you try this:

FileSetAttrib("C:\Users\Test\OneDrive","-R") ; 
ConsoleWrite(FileGetAttrib("C:\Users\Test\OneDrive") & @CRLF)

Is attribute "R" gone then? Can you now copy the directory?

Conrad


SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites
2 hours ago, hendrikhe said:
$a=DirCopy("C:\Users\Test\OneDrive", "D:\move",1)
MsgBox($MB_SYSTEMMODAL, "Title", $a)

$a=DirGetSize("C:\Users\Test\OneDrive")
MsgBox($MB_SYSTEMMODAL, "Title", $a)

result DirCopy = 0

result DirGetSize = 967179211

Remove the "1" parameter at the end of DirCopy and try again

PS: if everything fail you can use cmd as a workaround:

DirCreate("D:\new")

RunWait(@ComSpec & ' /c ' & 'copy "C:\Users\Test\OneDrive" "D:\new" /Y', "", @SW_HIDE)

 

Edited by Neutro

Share this post


Link to post
Share on other sites

@Neutro same result

@Simpel

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Test\Desktop\move.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop

+>14:09:59 AutoIt3.exe ended.rc:0
+>14:09:59 AutoIt3Wrapper Finished.

 

Share this post


Link to post
Share on other sites
RunWait(@ComSpec & ' /c ' & 'copy "C:\Users\Test\OneDrive" "D:\new" /Y', "", @SW_HIDE)

is the exact same thing as running  "copy "C:\Users\Test\OneDrive" "D:\new" /Y on Windows cmd.

If it's working using Windows cmd but not with the AutoIT code, it suggests that AutoIT has a privilege (rights) problem with your script.

If #RequireAdmin doesn't work, try compiling the script with it then right click on the exe and use "run as admin"

PS: you can use 

RunWait(@ComSpec & ' /c ' & 'copy "C:\Users\Test\OneDrive" "D:\new" /Y > c:\test.txt', "", @SW_HIDE)

To get the result of the copy command from autoit in c:\test.txt

Edited by Neutro

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...