Jump to content
hendrikhe

DirCopy OneDrive Folder is not working

Recommended Posts

hendrikhe

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
Simpel

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
hendrikhe

Thanks for reply. Tried but still same result

Share this post


Link to post
Share on other sites
JLogan3o13

Have you attempted adding #RequireAdmin at the top of your script?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
hendrikhe

Tried that too, same result. Strange is: it does work with the subfolders (even without  #RequireAdmin )

Share this post


Link to post
Share on other sites
Simpel

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
hendrikhe

Not sure how to get the output from : 

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

But DirGetSize("C:\Users\Test\OneDrive") got me the correct size of this folder

Share this post


Link to post
Share on other sites
Simpel

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
hendrikhe

>"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
Neutro

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
hendrikhe
$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

Share this post


Link to post
Share on other sites
Simpel

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
Neutro
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
hendrikhe

@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
Neutro
Neutro
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
hendrikhe

The copy command is too *heavy* for big files. 

tried with "move" but no result, I also need the subfolders moved

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

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.