david1337

Help with xcopy

6 posts in this topic

#1 ·  Posted (edited)

Hi guys

I'm a little stuck here, and could use some help.

All I want to do is copy all content from FolderA to FolderB, but I can only make it work if I define the entire path.

 

This works:

#include <Process.au3>

_RunDOS("xcopy C:\Users\USERNAME\AppData\Roaming\Microsoft\FolderA C:\Users\USERNAME\AppData\Roaming\Microsoft\FolderB /E /I")

 

But this doesn't:
 

#include <Process.au3> ;Makes sure that you can use _RunDos statements

$FolderA = @AppDataDir & "\Microsoft\FolderA\"
$FolderB = @AppDataDir & "\Microsoft\FolderB\"


_RunDOS("xcopy $FolderA $FolderB /E /I")

 

Any ideas? :)

 

David

Edited by david1337

Share this post


Link to post
Share on other sites



This is the way to do it.

#include <Process.au3> ;Makes sure that you can use _RunDos statements

$FolderA = @AppDataDir & "\Microsoft\FolderA\"
$FolderB = @AppDataDir & "\Microsoft\FolderB\"


_RunDOS("xcopy " & $FolderA & " " & $FolderB & " /E /I")

 

1 person likes this

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Hi Bowmore

Thanks for your reply!
That doesn't work for me :( No error messages, it just doesn't copy anything?

Share this post


Link to post
Share on other sites

in the 'working example'  they dont have a trailing backslash.  try it with run("cmd /k xcopy " .....)  and see if we can get an output?

1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

Remove the trailing backslashes from the 2 paths like you had in your first attempt.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

boththose,

thanks! Removing the trailing backslashes worked :)

@ Bowmore: Your example worked perfect when I removed the backslashes.

Thanks to both of you!

#include <Process.au3> ;Makes sure that you can use _RunDos statements

$FolderA = @AppDataDir & "\Microsoft\FolderA"
$FolderB = @AppDataDir & "\Microsoft\FolderB"


_RunDOS("xcopy " & $FolderA & " " & $FolderB & " /E /I")

 

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