Discussion Locked

Batch file for copying files on network

0 helpful
13 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need to create a batch file that will copy some files (they all have file extensions of .dss) out of a directory on the workstations across the network and into a folder on the server (Windows 2000 Server) automatically using the task scheduler.
Both workstations that need the script are Windows 98. Here is the path the files are in on the workstations:

C:\Program Files\Olympus\DSSPlayerPRO\Message\FolderA

I created a move.bat file using the DOS Move command with this info:

cd C:\Progra~1\Olympus\DSSPla~1\Message\FolderA
move *.dss \\Hocnr\Voice\Message\FolderB

I get two different error messages on each pc. One is "cannot move *.dss - no such file or directory" and the other is "unable to delete destination on FolderA". Both pc's have permissions to the directory on the server. Any ideas?

13 replies

by estebandelatorre

"cannot move *.dss - no such file or directory"
The main reasons may be:
One file in the list is open, thus it cannot be moved
The move.exe utility like xcopy, takes first a snapshot of the files to be moved, and then begin the operation. There may be a file in the snapshot which may be deleted or removed.

"Unable to delete destination on FolderA".
This means that a file cannot be replaced, the destination file to be removed may be opened or another operation (from another workstation)is happening into s subdir.
The destination directory may have been re-created (overwrited)

try move *.dss \\Hocnr\Voice\Message\ FolderB with the /Y otion in order to bypass any overwrite msg

by bradq

The procedure worked on a Windows 2000 Pro workstation I set up. It wasn't working on the 98's for some reason so to make it simple I just started at the server instead and mapped from there an X, Y, and Z drive to each workstation and set the scripts up to run from there but thank you all for your responses. They helped out a lot.

by curacao_dejavu

In general when creating a batch file test the commands manually before implementing them in a batch file. By doing this you would see from the beginning if there would be a problem.

the first error message means 1: it did find the files in the foldera or 2: it didnt change to the folder properly.
resolution: better use the following syntax:
cd\
C:\Progra~1\Olympus\DSSPla~1\Message\FolderA

why ? because since you running the command from windows it may start from the root folder (it starts probably from the c:\windows\dekstop folder)

the other error message I am not sure it seems it may not move the files (they may be in use)
solution: do a copy instead of move.

again, test them in the command line, first then program the batch file.

Also I would do a mapping to the folder of the w2k server.(ie h:)
than the copy command would be
copy *.dss to h: (it's a bit shorter syntax)

regards,

Leopold

by ann777

Your first line is fine.

Your second line will not work under any circumstances. You cannot use move to move multiple files... under DOS.

I recommend that you use:

copy *.dss \\hocnr\voice\message\folderb
c:
erase *.dss

by ann777

Also, be aware that the "copy *.dss (etc.)" will make one file of all the dss files. So if they are not text based, you may have a problem reading the resulting file. TEST FIRST BEFORE DELETING OR ERASING ANYTHING.

by ann777

One more thing, the resulting file will be called "folderb" -- you should probably add another "\filename.dss"

by jimbb

Well, I tried the move command manually on my Win98, and it functions nicely. Producing your messages as it should, if the files are not there.

Never mind about the permissions, the batchfile doesn't find the files. And besides, if you think the permissions bother you, just move the files to C:\SomeWhere, to test.

Try troubleshooting, just to see what happens, by typing "echo on" as the first line in your batch file, and a "pause" after each command.

Using "Progra~1" or so is a bit tricky, since you're never sure of the DOS name of a given directory. Try using the full name, between quotes, as in:
cd "C:\Program Files\Olympus\DSSPlayerPRO\Message\FolderA"

Let us know the results!

Jim

by @lberto

Sometimes DOS gives such a headaches.
I'd build it this way.
First pick one drive letter your not using. For example k:
*** From the Workstation ***
so ...
Rem Procedure to transfer some files over
Rem the network
Rem *
net use k: \\Hocnr\c$
Rem Where Honcnr is your Server Name
Rem and c$ is your share on the Honcnr server
Rem then ...
Rem *
c:
cd C:\Progra~1\Olympus\DSSPla~1\Message\FolderA
copy *.dss k:\Voice\Message\FolderB /y
Rem Once you're sure it copied properly then Rem delete the .dss files.
del *.dss
net use k: /d
Rem ***
Rem End of the Procedure
Rem ***
exit
and you have to do this with all the workstations

I just tested and it worked.

Good luck,

@lberto

This discussion is closed to new replies.