script to copy new files

  • Thread starter Thread starter Rob C
  • Start date Start date
R

Rob C

I have a batch file that users run to launch our
application. Before executing the program, it checks to
see if there is are later versions of a group of files and
if so copies them down to the desktop from the server.

This is the command line I am using:

replace /U \\myserver\rcs\forms\*.* C:\RCS\forms

However, I have cases where a new file needs to be copied
down to the desktop but the REPLACE only works if you
already have a copy of the file locally. I just want to
be able to copy a new file to the server and have it
automatically copied down to the desktop running the batch
file if it does not exist there.

Any ideas on how to approach this woiuld be greatly
appreciated.

Regards,

-Rob
 
Rob said:
I have a batch file that users run to launch our
application. Before executing the program, it checks to
see if there is are later versions of a group of files and
if so copies them down to the desktop from the server.

This is the command line I am using:

replace /U \\myserver\rcs\forms\*.* C:\RCS\forms

However, I have cases where a new file needs to be copied
down to the desktop but the REPLACE only works if you
already have a copy of the file locally. I just want to
be able to copy a new file to the server and have it
automatically copied down to the desktop running the batch
file if it does not exist there.

Any ideas on how to approach this woiuld be greatly
appreciated.

Regards,

-Rob

C:\>replace /?
Replaces files.

REPLACE [drive1:][path1]filename [drive2:][path2] [/A] [/P] [/R] [/W]
REPLACE [drive1:][path1]filename [drive2:][path2] [/P] [/R] [/S] [/W]
[/U]

[drive1:][path1]filename Specifies the source file or files.
[drive2:][path2] Specifies the directory where files are to be
replaced.
/A Adds new files to destination directory.
Cannot
use with /S or /U switches.
/P Prompts for confirmation before replacing a
file or
adding a source file.
/R Replaces read-only files as well as
unprotected
files.
/S Replaces files in all subdirectories of the
destination directory. Cannot use with the /A
switch.
/W Waits for you to insert a disk before
beginning.
/U Replaces (updates) only files that are older
than
source files. Cannot use with the /A switch.

Replace /a would seem to fit your requirements.

Dean
 
I only want to copy the files that don't already exist.
Won't XCOPy copy down all the files in the directory?

Regards,

-Rob
 
Rob,
I have used xcopy with the /d switch for many of my processes. if you don't
include a date in the switch, it will copy over only the files with a newer
time stamp. this should include files that don't exist in the destination
directory.
Hope it helps
Mark



Dean Wells said:
Rob said:
I have a batch file that users run to launch our
application. Before executing the program, it checks to
see if there is are later versions of a group of files and
if so copies them down to the desktop from the server.

This is the command line I am using:

replace /U \\myserver\rcs\forms\*.* C:\RCS\forms

However, I have cases where a new file needs to be copied
down to the desktop but the REPLACE only works if you
already have a copy of the file locally. I just want to
be able to copy a new file to the server and have it
automatically copied down to the desktop running the batch
file if it does not exist there.

Any ideas on how to approach this woiuld be greatly
appreciated.

Regards,

-Rob

C:\>replace /?
Replaces files.

REPLACE [drive1:][path1]filename [drive2:][path2] [/A] [/P] [/R] [/W]
REPLACE [drive1:][path1]filename [drive2:][path2] [/P] [/R] [/S] [/W]
[/U]

[drive1:][path1]filename Specifies the source file or files.
[drive2:][path2] Specifies the directory where files are to be
replaced.
/A Adds new files to destination directory.
Cannot
use with /S or /U switches.
/P Prompts for confirmation before replacing a
file or
adding a source file.
/R Replaces read-only files as well as
unprotected
files.
/S Replaces files in all subdirectories of the
destination directory. Cannot use with the /A
switch.
/W Waits for you to insert a disk before
beginning.
/U Replaces (updates) only files that are older
than
source files. Cannot use with the /A switch.

Replace /a would seem to fit your requirements.

Dean

--
Dean Wells [MVP / Windows platform]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l
 
Back
Top