mit wsh grösste und kleinste datei aus einem ordner herauslesen
geht das?
hallo allerseits
nun ich bin da ziemlich neu im wsh berreich...
ist es möglich mit wsh die grösste und die kleinste datei aus einem verzeichniss herauszulesen(anzeigen in msgbox) respektiv kann mir da jemand helfen?
grüsse aus der verregneten schweiz
balg
nun ich bin da ziemlich neu im wsh berreich...
ist es möglich mit wsh die grösste und die kleinste datei aus einem verzeichniss herauszulesen(anzeigen in msgbox) respektiv kann mir da jemand helfen?
grüsse aus der verregneten schweiz
balg
Please also mark the comments that contributed to the solution of the article
Content-Key: 62415
Url: https://administrator.de/contentid/62415
Printed on: April 24, 2024 at 22:04 o'clock
2 Comments
Latest comment
Hallo ToxxBalg und willkommen im Forum!
Versuch es damit:
Zur Formatierung der Ausgabe solltest Du Dir vielleicht noch etwas überlegen ...
Grüße
bastla
Versuch es damit:
'FolderMiniMax.vbs
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
If WScript.Arguments.Count > 0 Then
If fso.FolderExists(WScript.Arguments(0)) Then BasisPfad = WScript.Arguments(0)
End If
If BasisPfad = "" Then
Set Verzeichnis = CreateObject("Shell.Application") _
.BrowseForFolder(0, "Ordner wählen", 16, 17)
If TypeName(Verzeichnis) = "Nothing" Then WScript.Quit(1)
Set Basis = Verzeichnis.Self
BasisPfad = Basis.Path
End If
Anzahl = 0
For Each Datei In fso.GetFolder(BasisPfad).Files
Anzahl = Anzahl + 1
If Anzahl > 1 Then
If Datei.Size < Minimum Then
Minimum = Datei.Size
MiniFile = Datei.Name
ElseIf Datei.Size > Maximum Then
Maximum = Datei.Size
MaxiFile = Datei.Name
End If
Else
Minimum = Datei.Size
MiniFile = Datei.Name
Maximum = Datei.Size
MaxiFile = Datei.Name
End If
Next
If Anzahl > 0 Then
Text = "Datei"
If Anzahl > 1 Then Text = "Dateien"
MsgBox Anzahl & " " & Text & " gefunden" & vbCrLF & vbCrLF & _
"Kleinste (" & Minimum & " Bytes):" & vbTab & MiniFile & vbCrLF & _
"Größte (" & Maximum & " Bytes): " & vbTab & MaxiFile, _
vbOKOnly, "Auswertung für " & BasisPfad
Else
MsgBox "Keine Dateien gefunden!"
End If
Grüße
bastla