Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Rename  a  File  Every  Day,  Using  the  Current  Date  as  Part  of  the  File  Name  

 Content of Rename a File Every Day, Using the Current Date as Part of the File Name.vbs
MD5 Hash: DBB57F873AC91CE2BF3E758AC93F68DD
strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

strMonth = Month(Date - 1)

If Len(strMonth) = 1 Then
strMonth = "0" & strMonth
End If

strDay = Day(Date - 1)

If Len(strDay) = 1 Then
strDay = "0" & strDay
End If

strYear = Year(Date - 1)

strFileName = "C:\\Test\\BackupFile-" & strMonth & strDay & strYear & ".txt"

Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where Name = '" & strFileName & "'")

For Each objFile in colFiles

strMonth = Month(Date)

If Len(strMonth) = 1 Then
strMonth = "0" & strMonth
End If

strDay = Day(Date)

If Len(strDay) = 1 Then
strDay = "0" & strDay
End If

strYear = Year(Date)

strNewFileName = "C:\\Test\\BackupFile-" & strMonth & strDay & strYear & ".txt"

errResult = objFile.Rename(strNewFileName)
Next



   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a