Sign in to follow this  
Followers 0
ACalcutt

DirCopy

14 posts in this topic

I am trying to use the dir copy command to do a file backup/sync

i tried

DirCopy( "X:", "C:\Documents and Settings\Andrew\Desktop\synclocal")

DirCopy( "X:\", "C:\Documents and Settings\Andrew\Desktop\synclocal")

DirCopy( "X:\Folder", "C:\Documents and Settings\Andrew\Desktop\synclocal")

non of them have seems to work. X: is a mapped network drive


Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites



I am trying to use the dir copy command to do a file backup/sync

i tried

DirCopy( "X:", "C:\Documents and Settings\Andrew\Desktop\synclocal")

DirCopy( "X:\", "C:\Documents and Settings\Andrew\Desktop\synclocal")

DirCopy( "X:\Folder", "C:\Documents and Settings\Andrew\Desktop\synclocal")

non of them have seems to work. X: is a mapped network drive

Have you tried making the destination somewhere other than the desktop, I seem to remember someone else with a similar problem.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

i use this for "talking" to another drive on the network

"\\computer-name\c on stelth\tsdata\"

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

i cant even get this to work

DirCopy( "C:\sync", "C:\syncfolder")

there is 1 text file in the c:\sync and c:\syncfolder has nothing....if i run that comman i still have the same thing. am i misunderstanding this function or should it do like i think and copy the text file to c:\syncfolder

i was using FileCopy at first...but i need to copy subdirs also...and filecopy doesn't do that

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites

i cant even get this to work

DirCopy( "C:\sync", "C:\syncfolder")

there is 1 text file in the c:\sync and c:\syncfolder has nothing....if i run that comman i still have the same thing. am i misunderstanding this function or should it do like i think and copy the text file to c:\syncfolder

i was using FileCopy at first...but i need to copy subdirs also...and filecopy doesn't do that

It works for me, but FileCopy should also work if you use the correct flag.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

try DirCopy( "C:\sync", "C:\syncfolder",1)

that did work...but i dont want to overwrite existing files because i am using it to sync mp3 files in a car pc when the wireless connection gets an IP address. this is the only part of the script that wasn't working right

i am guessing its not working without overwrite because the folder exists and its set not to overwrite?

*edit* i confirmed that if I delete C:\syncfolder

DirCopy( "C:\sync", "C:\syncfolder") does work

anything else i could do so it won't transfer all these files every time.

-----

About the filecopy comment. it worked to copy the files using

FileCopy(X:\*.*, C:\syncfolder) but it ignores the dirs...what would i use to make it copy the dirs also?

Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites

maybe like this

DirGetSize(@HomeDrive & "\Temp\")

If @error= 1 Then

DirCreate(@HomeDrive & "\Temp\")

EndIf

FileCopy(X:\*.*, (@HomeDrive & "\Temp\")

???

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

FileCopy(X:\*.*, C:\syncfolder) but it ignores the dirs...what would i use to make it copy the dirs also?

FileCopy(X:\*.*, C:\syncfolder,8)



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

just curios...where did you get that flag from...in the help file i only see 0 for default and 1 for overwrite

FileCopy

--------------------------------------------------------------------------------

Copies one or more files.

FileCopy ( "source", "dest" [, flag] )

Parameters

source The source path of the file(s) to copy. Wildcards are supported.

dest The destination path of the copied file(s).

flag [optional] this flag determines whether to overwrite files if they already exist.

Can be a combination of the following:

0 = (default) do not overwrite existing files

1 = overwrite existing files

8 = Create destination directory structure if it doesn't exist (See Remarks).

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

just curios...where did you get that flag from...in the help file i only see 0 for default and 1 for overwrite

You are reading the help file for the release version, we are reading the Beta Help File.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

You are reading the help file for the release version, we are reading the Beta Help File.

so i am guessing i need the beta version for this command to work properly...because using 8 didn't seem to copy the folders either....i will download the beta


Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites

I found a small commandline utility that does what i need called fsync...its a 76k standalone exe file...comman line ...

so RunWait("fsync.exe X:\ C:\syncfolder /S") does what i need

or more specific in my program its more like this

DriveMapAdd( $MapPath, $NetworkPath)

$sync = "fsync.exe " & """" & $MapPath & """" & " " & """" & $LocalPath & """" & " /S"

RunWait($sync)


Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

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  
Followers 0