How can I do this

geoffcodd

Registered User.
Local time
Today, 13:16
Joined
Aug 25, 2002
Messages
87
I have a database which is run on my local hard drive, as i am the main user and the only one who makes changes to it and can't afford for the network to go down. there is a copy of this which is stored on the network and a dozen or so people have access. What I need to do is copy the version from my pc to the network at a particular time every day.

I know that I need to create a batch file and add this to scheduler but what I need to put it the batch file I'm not sure on.

The file I need to copy is

C:\Program Files\em\em.mdb

and it needs to replace the file

G:\E&S\Energy\em\em.mdb

any help would be appreciated

Thanks
Geoff
 
Copied straight from the help file in Windows NT:

Copy

Copies one or more files to another location.
This command can also be used to combine files. When more than one file is copied, Windows_NT displays each filename as the file is copied.
copy [/a|/b] source [/a|/b] [+ source [/a|/b] [+ ...]] [
destination [/a|/b]] [/v] [/n] [/z]

Parameters

source
Specifies the location and name of a file or set of files from which you want to copy. Source can consist of a drive letter and colon, a directory name, a filename, or a combination.
destination
Specifies the location and name of a file or set of files to which you want to copy. Destination can consist of a drive letter and colon, a directory name, a filename, or a combination.
/a
Indicates an ASCII text file. When the /a switch precedes the list of filenames on the command line, it applies to all files whose names follow the /a switch, until copy encounters a /b switch, in which case the /b switch applies to the file whose name precedes the /b switch.

When the /a switch follows a filename, it applies to the file whose name precedes the /a switch and to all files whose names follow the /a switch, until copy encounters a /b switch, in which case the /b switch applies to the file whose name precedes the /b switch. An ASCII text file can use an end-of-file character (CTRL+Z) to indicate the end of the file. When combining files, copy treats files as ASCII text files by default.

/b
Indicates a binary file. When the /b switch precedes the list of filenames on the command line, it applies to all files whose names follow the /b switch, until copy encounters an /a switch, in which case the /a switch applies to the file whose name precedes the /a switch.
When the /b switch follows a filename, it applies to the file whose name precedes the /b switch and to all files whose names follow the /b switch, until copy encounters an /a switch, in which case the /a switch applies to the file whose name precedes the /a switch.

The /b switch specifies that the command interpreter is to read the number of bytes specified by the file size in the directory. The /b switch is the default value for copy unless copy is combining files.
/v
Verifies that new files are written correctly.
/n
Uses a short filename, if available, when copying a file with a non-8dot3 name.
/z
Copies over a network in restartable mode.

If you need more assistance, let me know. I have created many batch files in the past.
 
thanks for your reply

I had seen this but it just didn't make any sense, if you could put it in more basic terms I'd appreciate it

Thanks
Geoff
 
I've sorted it now the problem I was having was with long file names

Thanks
 
Ahhh, yes. Batch files rely on dos file names. If it is more than 8 characters, it would need to be renamed or the dos name would have to be used.
 
Long filenames in batch files

Actually you can do long filenames in batch files. I too for ages had kittens over the short filename situation with batch files, until someone pointed out that all you need to do is enclose the directory location and the file name extension etc in quotes.

ie.
xcopy "C:\Documents and Settings\Tech Stuff\Favorites\This is a very long filename.txt"
 

Users who are viewing this thread

Back
Top Bottom