How to automatically move a file to another PC on the network?

2

0

Here is what I am after.

I have 2 PCs connected on a network and one of them prints out an Excel spreadsheet every night to a specific folder. Is it possible to use a batch script to copy that file to the other computer on the network at a certain time?

Keith Donegan

Posted 2009-07-28T22:01:53.890

Reputation: 244

Answers

6

You can.

  • Create Batch File (Use UNC paths to copy - I recommend RoboCopy)
  • Create Scheduled Task to call batch file at certain time
robocopy C:\FolderName\ \\machinename\sharedfolder "filename.ext"

BinaryMisfit

Posted 2009-07-28T22:01:53.890

Reputation: 19 955

If you don't want to use robocopy you can also map a network drive for the remote destination and then just use copy. – jtb – 2009-07-28T22:08:08.013

@jtb - Agreed. Robocopy is faster however and supports resuming. The only reason I suggest it. Also it is more robust when using UNC. – BinaryMisfit – 2009-07-28T22:13:07.830

2

Set up a scheduled task to run a program/batch file that executes a copy command.

A batch file to do that might look like

COPY \\server-name\path\to\file.dat C:\directory\new-location\

kquinn

Posted 2009-07-28T22:01:53.890

Reputation: 780

1

An alternative to a batch file / Windows scheduled task, is to use SyncBack (freeware) where you can create a profile to copy your Excel spreadsheet from the source machine to the target at a specific time.

Pauk

Posted 2009-07-28T22:01:53.890

Reputation: 924

1

You can save this in a .bat file. After that you can schedule it.

:: This is the backup 


set SourceDir=F:\XXX
set DestinyDir=I:\YYY


xcopy /e /v /y /I %SourceDir% %DestinyDir%

I never tested the time it takes, but it seems that xcopy is faster than the regular copy. Look what the commands do here.

Artur Carvalho

Posted 2009-07-28T22:01:53.890

Reputation: 1 617

1

Another option is to use the Windows SyncToy 2.0 utility and then set a scheduled task along with it.

quickcel

Posted 2009-07-28T22:01:53.890

Reputation: 4 203