hendrikhe

DirCopy OneDrive Folder is not working

21 posts in this topic

#1 ·  Posted

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



#2 ·  Posted

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


SciTE = 3.6.2.0/full   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

#3 ·  Posted

Thanks for reply. Tried but still same result

Share this post


Link to post
Share on other sites

#4 ·  Posted

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

#5 ·  Posted

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

#6 ·  Posted

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)

 


SciTE = 3.6.2.0/full   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

#7 ·  Posted

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

#8 ·  Posted

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


SciTE = 3.6.2.0/full   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

#9 ·  Posted (edited)

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

#10 ·  Posted (edited)

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

#11 ·  Posted

$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

#12 ·  Posted

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


SciTE = 3.6.2.0/full   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

#13 ·  Posted (edited)

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

#14 ·  Posted

@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

#16 ·  Posted

yes :(

Share this post


Link to post
Share on other sites

#17 ·  Posted

Share this post


Link to post
Share on other sites

#18 ·  Posted

that worked :o

1 person likes this

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

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

#20 ·  Posted

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