Copy file problem

M

Mangler

I have the DB backed up everynight automatically and am trying to
create a .bat file to automatically copy the directory of the back ups
to a folder on my PC. I am running a test and everything works with
one weird flaw, here is what I have so far:

COPY /y C:\test.txt Y:\serverBakUp

It puts the file on my PC but does not retain the original file name.
After I run that script the test.txt file gets copied to my PC but it
is name serverBakUp ( the name of the directory it goes to ) with no
file extention. What am I missing here?
 
B

Big_Al

Mangler said:
I have the DB backed up everynight automatically and am trying to
create a .bat file to automatically copy the directory of the back ups
to a folder on my PC. I am running a test and everything works with
one weird flaw, here is what I have so far:

COPY /y C:\test.txt Y:\serverBakUp

It puts the file on my PC but does not retain the original file name.
After I run that script the test.txt file gets copied to my PC but it
is name serverBakUp ( the name of the directory it goes to ) with no
file extention. What am I missing here?

COPY /y C:\test.txt Y:\serverBakUp\test.txt

or

COPY /y C:\test.txt Y:\serverBakUp\

Also take a look at robocopy. It has a /MIR command that mirrors a
folder and subfolder structure and files with one simple command. Great
for backups. It takes into consideration files deleted too. It also
skips files that are not touched.
 
M

Mangler

One question on robocopy. I have it set to monitor a directory and it
is working great, however if I restart the machine will that directory
still be monitored or do I have to re-run the script each time that
happens?
 
B

Big_Al

Mangler said:
One question on robocopy. I have it set to monitor a directory and it
is working great, however if I restart the machine will that directory
still be monitored or do I have to re-run the script each time that
happens?

I've never used the monitor. But I think you have to have robocopy
running, so yes, you'll have to run the batch.
CTRL-ALT-DEL will tell you if its running better probably.
 
M

Mangler

OK I think I am on the last step here. Do you know off the top of
your head how I can get a .bat file to run without actually showing
the dos window?
 
B

Big_Al

Mangler said:
OK I think I am on the last step here. Do you know off the top of
your head how I can get a .bat file to run without actually showing
the dos window?
You might be able to make a shortcut to it, I know shortcuts have the
ability to specify run minimized.
 
M

M.I.5¾

Mangler said:
I have the DB backed up everynight automatically and am trying to
create a .bat file to automatically copy the directory of the back ups
to a folder on my PC. I am running a test and everything works with
one weird flaw, here is what I have so far:

COPY /y C:\test.txt Y:\serverBakUp

It puts the file on my PC but does not retain the original file name.
After I run that script the test.txt file gets copied to my PC but it
is name serverBakUp ( the name of the directory it goes to ) with no
file extention. What am I missing here?

Try:

COPY /y C:\test.txt Y:\serverBakUp\

(the trailing '\' identifies serverBakUp as a folder whereas if it is
missing it becomes a file name.
 
M

Mangler

You might be able to make a shortcut to it, I know shortcuts have the
ability to specify run minimized.

Figured it out! I have seen a lot of similar questions on how to run
the .bat file with the robocopy command without showing the "DOS"
window. I will post the solution in case someone else runs into this.


You need to create a vbs file to run the .bat program and add a "0"
param at the end of the vbs statment like so:

Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("cmd.exe /K ""FILE_NAME.cmd""", 0, true)

That runs the command without showing the window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top