Copy Files From One Folder to Another

infinitx

Registered User.
Local time
Today, 17:03
Joined
Mar 22, 2004
Messages
63
Hi,

I have a folder "C:\Databases" and I have the following files in it: db1.mdb, db2.mdb, db3.mdb, and db4.mdb. I want to copy these files into a folder "C:\Databases2" with a click of a command button.

How can this be done?

Thank you!
 
infinitx said:
Hi,

I have a folder "C:\Databases" and I have the following files in it: db1.mdb, db2.mdb, db3.mdb, and db4.mdb. I want to copy these files into a folder "C:\Databases2" with a click of a command button.

How can this be done?

Thank you!

Make a batch file and and use RunApp in a macro to run the file.

To make a batch file and say for the C:> type the following at the C prompte

Copy con filename.bat
c:
cd\Databases
Copy *.mdb \databases2
Type Control Z here and then the enter key and a message will come up 1 file copied.

If you want to edit it go to where the file is in Explorer and right click on it and then Edit

For the macro mkae the first action SetWarnings and use No
Next action line is RunApp and enter in the command line at the bottom of your macro page

c:\Filename.bat

Assuming of course that you made the file on C:

Mike
 
Last edited:
Why would you want to make an external call to run a batch file when you can easily do it with VBA using the File System Object? The above link I posted has two code examples on how to copy files and directories from one location to another.
 
ghudson said:
Why would you want to make an external call to run a batch file when you can easily do it with VBA using the File System Object? The above link I posted has two code examples on how to copy files and directories from one location to another.

Because I went to the link and it all looked too hard so I gave him what I do. He can either do what is in your link or do what I posted or do nothing :D

For me the batch file has always been easy and especially when I have about 60 of them that copy Word docs from my folder SpareLetters to my folder Letters that have been set up with Bookmarks and links to queries.

Mike
 
infinitx said:
Hi,

I have a folder "C:\Databases" and I have the following files in it: db1.mdb, db2.mdb, db3.mdb, and db4.mdb. I want to copy these files into a folder "C:\Databases2" with a click of a command button.

How can this be done?

Thank you!

Just my 2 cents; If you have .mdb's floating around named db1, db2, etc., you have bigger problems...
 
Thanks ghudson. Your code worked!


Mike375,

What is so hard about the code? It seems pretty straight forward!

Also, I'm not a big fan of Batch Files as I like to have everything in one database and not rely on external files!


KenHigg,

I was just using that as an example! :)

Alex
 
Also, I'm not a big fan of Batch Files as I like to have everything in one database and not rely on external files!

I will explain. I have about 60 of them all sitting on Local Disk C and with names like Spares*** so they all sit together and I also have some for copying .mdbs to the CD ROM. I often email them to people which is easy for both myself and the receiver than sending something from the .mdb, at least with my knowledge. In addition it is very easy to show somone over the phone how to make a another batch file. They just make a copy and go to Edit.

Having said that I do agree when all else is equal it is best if eberthing can be kept in the .mdb. In fact our system for producing letters is done from Access and the letter is copied and pasted back to a memo field on the persons record.

By the way, on the subject of code, sometime ago a poster on dBForums was trying to change the caption on a label on a subform and do the "click" on a second subform. The code was not working a but a Setvalue macro worked. Might be interesting to try.

Mike
 

Users who are viewing this thread

Back
Top Bottom