September 18, 2018

These scripts are free to use without any licensing or permissions.

Like music, it all started somewhere and we are doing nothing more than writing that first song over and over again.
These scripts started somewhere, I can’t recall every last origin so I have included the Links and Resources page for that.
The Downloads page contains the executable versions of these scripts.


MKList (MKList.bat)
This simple batch script generates a list of all files in a folder and sub directories.

::MKList File and Folder List Generator | R. Seaverns 2018
::This will create a list of files, folders and size based on the directory selected.
::Default is C:\ (..\) based on the installation path.

@ECHO OFF
::Set Parameters
SET “Dir1=C:\”
SET “FileType=*”
SET “List=FileList.txt”

ECHO.
ECHO Please Wait While I Collect The File List.
ECHO This May Take A While.
::Command prompt error occurs – interrupt to continue
ECHO Use CTRL+C and Select N to Continue.

::Check All Folders
::List Path and Size (Option 1)

FOR /f “tokens=*” %%a in (‘dir %Dir1% %FileType% /s /b ‘) do echo %%~fa %%~za | sort >> %List%

::List File Size Only (Option 2)
::FOR /f “tokens=*” %%a in (‘dir %Dir1%*%FileType% /s /b’) do echo %%~za >> %List%

::End Of Program.
CLS
ECHO.
ECHO List Generated, Thank You For Your Patience.
PAUSE
EXIT


GetFile (Getfile.vbs)
A very simple VBScript to download files from the internet.

Dim urlBox
Dim oX
urlBox = InputBox (“Enter URL:”)
Set oX = CreateObject(“Microsoft.XmlHTTP”)
oX.Open “GET”, urlBox, False
oX.Send “”
WScript.Echo oX.responseText


GetFile II (GetFile.vbs)
A little more complex VBScript based on the original GetFile.vbs in which a list of links (linklist.txt)
contains the files to download.

Function ReplaceRegEx(origString,replaceString,replaceWith)
Set TempRegEx=New RegExp
TempRegEx.Pattern=replaceString
TempRegEx.IgnoreCase=True
ReplaceRegEx = TempRegEx.Replace(origString,replaceWith)
End Function
msgbox “GetFile Multi-File Download | R. Seaverns”
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objDictionary = CreateObject(“Scripting.Dictionary”)
currentDirectory = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
UserInput = InputBox(“Type > linklist.txt”)
If UserInput = “” Then
msgbox “No Filename Entered”
Else
If objFSO.FileExists(currentDirectory & UserInput) Then
msgbox “File Entered”
ForReading = UserInput
Set objFile = objFSO.OpenTextFile(currentDirectory & UserInput,1)
i = 0
Do Until objFile.AtEndOfStream
strNextLine = objFile.Readline
If strNextLine <> “” Then
objDictionary.Add i, strNextLine
End If
i = i + 1
Loop
objFile.Close
msgbox “Links Read.”
msgbox “Downloading..Please Wait.”
currentDirectory=Mid(currentDirectory,1,Len(currentDirectory)-1)
For Each strLine in objDictionary.Items
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
linkNameSplit=Split(strLine,”/”)
linkNameNumber=UBound(linkNameSplit)
linkNameTemp=””
For i = 3 To linkNameNumber-1
linkNameTemp=linkNameTemp&”\”&linkNameSplit(i)
newfolderpath=currentDirectory & linkNameTemp
If Not objFSO.FolderExists(newfolderpath) Then
objFSO.CreateFolder(newfolderpath)
End If
Next
strFileURL = strLine
strHDLocation = currentDirectory & linkNameTemp &”\”& linkNameSplit(linkNameNumber)
msgbox “Downloading File From: ” & strFileURL & vbCrLf & “Downloading File To: ” & strHDLocation
Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 ‘Set the stream position to the start
Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
Next
msgbox “Download Complete.”
Else
msgbox “Error – File Does not Exist.”
End if
End if



Web Development - Web Site - Web Page - Security - Software - Yakima - Washington

Get Started Today!

Like and Share!

Follow by Email
Facebook
Facebook
Google+
Google+
http://www.robseaverns.com/scripts">
YouTube