Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    *.bat file question (Access 2000 )

    I know this isn't necessarily an access question but I thought I try any way. I'm writing a batch file that I would like to use to copy an entire directory and all of it's contents to c:backup on my hard drive. Does anyone have an idea of how to do this? Thanks..

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: *.bat file question (Access 2000 )

    Here is a really simple example.

    Every time a form opens in access, you need to delete a file saved on the C drive. The file happens to be a Microsoft Project file and is named MSP.

    You could create a batch file, say MSP.bat with the following in it:

    Del C:MSP*.*
    Exit

    Then execute the bat file with the following command in code in access:

    RETVAL = Shell("C:MSP.BAT", 1)

    Of course if any other files on the C drive are named MSP, they would be deleted as well and you need to have the .bat file on the c drive. You could also create the .bat file on the fly when the database opens so you it would always be present and avoid errors.

    I am sure there are better ways to do this, but here is an example.

    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: *.bat file question (Access 2000 )

    Something like this:

    XCOPY C:MyDir*.* C:Backup /s

    You can add a /y if you don't want a message to replace like named files.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •