+ Reply to Thread
Results 1 to 3 of 3

Thread: Need to automatically backup certian files...

  1. #1
    Barn Regular bryceowen is on a distinguished road bryceowen's Avatar
    Join Date
    Sep 2008
    Location
    Jacksonville, FL
    Posts
    93
    Rep Power
    4

    Need to automatically backup certian files...

    ***SOLVED***
    I'm trying to backup a folder using a vb script that will create a folder with the current date then copy the contents of the source into it. I've been working so hard on learning PHP that I'm a little out of sorts with vb.

    Here's what I have so far:
    Code:
    dim dbcopy
    dim foldername
    dim killme
    
    foldername="C:\backup\"&weekdayname(weekday(day(date())))&"\"
    set dbcopy=CreateObject("Scripting.FileSystemObject")
    if dbcopy.FolderExists(foldername) then
      killme=dbcopy.GetFolder(foldername)
      killme.Delete
    end if
    dbcopy.CreateFolder(foldername)
    dbcopy.CopyFile "C:\Inetpub\wwwroot\_private\*.*", foldername
    
    If the given weekday folder doesn't exist, this script works fine. But if the folder exists, I get an error 'Object required: 'C:\backup\Thursday'.' It doesn't delete the folder like I thought it should... Can anyone offer assistance, please?

    ***EDIT***
    I found the solution. I changed:
    Code:
      killme=dbcopy.GetFolder(foldername)
      killme.Delete
    
    to:
    Code:
      dbcopy.DeleteFolder(foldername)
    
    And I had to remove the trailing &"\" from the foldername line. It didn't like that.
    Last edited by bryceowen; March 26th, 2009 at 07:27 PM. Reason: Found the solution...

  2. #2
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    try this:
    Code:
    if dbcopy.FolderExists(foldername) then
      dbcopy.DeleteFolder foldername
    end if
    
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  3. #3
    Barn Regular bryceowen is on a distinguished road bryceowen's Avatar
    Join Date
    Sep 2008
    Location
    Jacksonville, FL
    Posts
    93
    Rep Power
    4

    Heh, you replied as I was typing my edit. Thanks, though!

+ Reply to Thread

Similar Threads

  1. Excel (take worksheet from 2 files?)
    By Rebelle in forum Microsoft Office
    Replies: 22
    Last Post: April 22nd, 2009, 03:27 PM
  2. Database backup (URGENT)
    By plugsharma in forum Microsoft SQL Server
    Replies: 3
    Last Post: November 26th, 2008, 05:49 AM
  3. Moving backup (.bak) file
    By Rebelle in forum Microsoft SQL Server
    Replies: 8
    Last Post: July 8th, 2008, 03:03 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

SEO by vBSEO