Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


VB file naming script

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1543
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB file naming script
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 VB file naming script - 10/30/2004 7:07:16 PM   
  vir_pat98

 

Posts: 8
Score: 0
Joined: 10/22/2004
From:
Status: offline
hi,
iam running a backupscript as follows

on Error Resume Next

Dim oFile,FS
Dim TempDate
Dim sTruePath,Bak_Path
Dim oDay,oMonth

oDay=Day(date)
oMonth=month(date)

IF len(oMonth)=1 Then
oMonth="0" & oMonth
end if
IF len(ODay)=1 Then
oDay="0" & oDay
End if

sTruePath="D:\Drushti\Daily_SQL_Backup"
Bak_Path="D:\Drushti\Daily_SQL_Backup\Zip_Data\"
'
Set FS=CreateObject("Scripting.FileSystemObject")

If (fs.FolderExists(sTruePath)) Then
Set oFile = fs.CreateTextFile(sTruePath & "\sql.bat", True)
oFile.writeline "@ECHO OFF"
oFile.writeline "Del " & bak_Path & "*.zip"
oFile.writeline "Del sql.lst"
For X = 1 to 7
theDate = DateAdd("d", -X, Date)
themonth = month(theDate)
theyear = year(theDate)
theday = day(theDate)
oFile.writeline "Dir/o/s/b *_db_" & theyear & themonth & theday & "*.BAK >> sql.lst"
oFile.writeline ""
Next
oFile.writeline "C:\Progra~1\Winzip\wzzip " & Bak_Path & year(date) & oMonth & oDay & ".ZIP @sql.lst -a+"
oFile.Close
Set oFile = Nothing
End If
Set FS=Nothing

now, what i want is to edit this line "oFile.writeline "C:\Progra~1\Winzip\wzzip " & Bak_Path & year(date) & oMonth & oDay & ".ZIP @sql.lst -a+"" this makes a zip file with the name containing current date, this zip file contains previous 7 days sql databases backup. so i wanted to name it like 25_nov-1_Dec.zip. how could i do this, please help me
 
 
Post #: 1
 
 Re: VB file naming script - 11/1/2004 2:53:31 AM   
  amumaugh

 

Posts: 5
Score: 0
Joined: 11/1/2004
From:
Status: offline
Add these lines in the appropriate places

      

and replace your write line with this one

      

(in reply to vir_pat98)
 
 
Post #: 2
 
 Re: VB file naming script - 11/1/2004 5:29:03 PM   
  vir_pat98

 

Posts: 8
Score: 0
Joined: 10/22/2004
From:
Status: offline
thanks a lot, it worked, it doesn't need any type of change. so nice of you

(in reply to vir_pat98)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> VB file naming script Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts