Results 1 to 10 of 10

Thread: New To this site

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    8

    New To this site

    Sorry just joined this site and i have a network/programming question.
    Basically need help with batch file I created that zips a data directory - then backs up to alternate hard drive and names them as the computer date.
    Not sure where I need to post the questions I need to ask.
    Any help would be greatly apperciated.
    Thanks

  2. #2
    SG Enthusiast RaisinCain's Avatar
    Join Date
    Jun 2009
    Posts
    1,705
    Welcome! What type of assistance do you need (specifically)?

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    Thanks.
    SO we have a database that i want to have a months worth of backup for.
    I am in testing phase now and cannot get it to work correctly.
    We have a access database on a 2003 server. there is a lot of data in the shared data directory. to save time and data going across the network my plan is to first- do a quick copy backup of the data directory - then run a pkzip cmd to zip it down - then back it up to a different HD named the days of the month. ex 1- 2- 3.
    Here is what i have so far:
    xcopy \\termserv\medtech\*.* /s /y E:\chris

    C:\MedTech\MTPost\pkzip -r -p E:\backup E:\chris\*.*

    @echo off
    :: variables
    set drive=E:\test
    set folder=%date:~7,2%
    set backupcmd=xcopy /y /s /i /f /c /EXCLUDE:C:\exclude.txt

    echo ### Backing up directory...
    %backupcmd% "E:\backup.zip" "%drive%\%folder%"

    echo Backup Complete!
    @pause

    I keep getting one of two errors. either the Cannot perform a cyclic copy so then i take the /s out but then i get the Does the E:\test\13 specify a file name or directory.
    Any help would be greatly appreciated.
    Thank you

  4. #4
    Administrator Philip's Avatar
    Join Date
    May 1999
    Location
    Jacksonville, Florida, United States
    Posts
    8,290
    Blog Entries
    6
    %backupcmd% "E:\backup.zip" "%drive%\%folder%"

    Basically, when you translate your %...% variables, that tranlates to:
    xcopy /y /s /i /f /c /EXCLUDE:C:\exclude.txt "E:\backup.zip" E:\test\[month]"

    However, depending on your OS, you may have to change the "set folder=%date:~7,2" command. It means take two characters, starting from the 7th character from the "date" command.

    Execute "date /t" in command prompt, and see at which character does the month and day start ? The default for US Windows 7 is the days start at the seventh character, it could be different in your case.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    U tried what you suggested and it did not help. instead of 13 - it just displayed 3.
    I need to tell you I manually changes my computer to the 13 th for testing purposes.

  6. #6
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    I was thinking if there was a way to add a pause for like a few seconds - then somehow have a command that typed the letter "d" so that the file or directory is taken care of?
    is there a way to do that?

  7. #7
    Administrator Philip's Avatar
    Join Date
    May 1999
    Location
    Jacksonville, Florida, United States
    Posts
    8,290
    Blog Entries
    6
    For the %folder%, you need to figure out what does "date /t" in command prompt display, exactly ?
    You need this info to display the date correctly, it varies depending on the OS/locale. Just count the number of characters to decide where it should start, or post the results of the "date /t" command here and I can help.


    Seems your source is a file, and youd destination is a folder, that is why you're getting the second error. Try this line instead:

    %backupcmd% "E:\backup.zip" "%drive%\%folder%\backup.zip"

  8. #8
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    I tried: %backupcmd% "E:\backup.zip" "%drive%\%folder%\backup.zip"
    I got the same error???
    Here is what i get from date /t:
    Sat 03/16/2013

  9. #9
    Administrator Philip's Avatar
    Join Date
    May 1999
    Location
    Jacksonville, Florida, United States
    Posts
    8,290
    Blog Entries
    6
    With that date format, your original should be right: set folder=%date:~7,2%

    xcopy is usually not needed for copying single files, it is intended more for copying directory structures. Why not use simple "copy" instead ?
    Not sure what the "/EXCLUDE:C:\exclude.txt" is there for either.

  10. #10
    Junior Member
    Join Date
    Mar 2013
    Posts
    8
    Thanks for your help. I managed to figure it out. Here is what I wound up coming up with:
    xcopy \\termserv\medtech\*.* /s /y c:\backup /EXCLUDE:C:\exclude.txt

    C:\MedTech\MTPost\pkzip -r -p c:\backup c:\backup\*.*

    xcopy c:\backup.zip /s /c /y e:\backup\%date:~7,2%\*.* /i
    the "/i" took care of my Directory or File error.

Similar Threads

  1. Site-to-site VPN Cisco 1811 - wireless
    By Robert Jacobs in forum alt.comp.networking.routers
    Replies: 8
    Last Post: 12-03-09, 02:16 PM
  2. Replies: 1
    Last Post: 10-09-07, 11:39 AM
  3. Replies: 16
    Last Post: 10-02-06, 06:26 PM
  4. Help Setting Up Site-to-Site VPN between Symantec 200R and NetGear FWG114Pv2
    By techsvcs146 in forum Routers & Internet Sharing
    Replies: 0
    Last Post: 03-13-06, 08:36 PM
  5. wierd problem going to different site from prior site
    By acr123 in forum General Broadband Forum
    Replies: 0
    Last Post: 12-30-02, 05:48 PM

Bookmarks

Posting Permissions

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