[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting folder size
[Thread Prev] | [Thread Next]
- Subject: Re: getting folder size
- From: System64 Development <64xcode@xxxxxxxxx>
- Date: Wed, 13 Mar 2024 11:28:32 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
El 12/3/24 a las 20:17, Bruce Steers escribió:
I made a function to get a folder size but it differs to du command.
Try this: z = DirSize(User.Home &/ "Descargas", True) Print "DSize: " & z Public Function DirZip(sDir As String) As String Dim sFile As String Dim cmd As String Dim uDir As String Dim cDir As String uDir = File.ParentDir(sDir) cDir = Split(sDir, "/")[Split(sDir, "/").Max] sFile = sDir & ".zip" cmd = "cd '" & sDir & "';zip -jr '" & sFile & "' *.*" If cmd <> "" Then Shell cmd Wait Endif If Exist(sFile) Then Return sFile Else Return "" Endif EndPublic Function ScanFiles(sPath As String, Optional ext As String[], Optional maxdepth As Integer, Optional sFilter As String, Optional bSymbolic As Boolean) As String[]
Dim out As New String[] Dim t As String Dim ex As String Dim sTmp As String Dim aOut As New String[] Dim sType As String Dim sMax As String If maxdepth > 0 Then sMax = " -maxdepth " & CStr(maxdepth) Endif If bSymbolic Then sType = " -type f,l" Else sType = " -type f" Endif If Exist(sPath) Then If ext Then Select ext.Count 'Case 0' Shell "find '" & sPath & "'" & sMax & sType & " -printf '%p\n' 2>&1" To t
Case 1Shell "find '" & sPath & "'" & sMax & sType & " -name '*.'" & ext[0] & " -printf '%p\n' 2>&1" To t
Case Else ex = "\\( -name \"*." ex &= ext.Join("\" -o -name \"*.") ex &= "\" \\)"Shell "find '" & sPath & "'" & sMax & sType & ex & " -printf '%p\n' 2>&1" To t
End Select ElseShell "find '" & sPath & "'" & sMax & sType & " -printf '%p\n' 2>&1" To t
Endif out = Split(t, "\n") If out.Count > 0 Then If out[out.Max] = "" Then out.Remove(out.Max, 1) Endif Endif Endif If sFilter <> "" Then For Each sTmp In out If InStr(sTmp, sFilter) > 0 Then aOut.Add(sTmp) Endif Next Else aOut = out.Copy() Endif Return aOut End
Re: getting folder size | System64 Development <64xcode@xxxxxxxxx> |
getting folder size | Bruce Steers <bsteers4@xxxxxxxxx> |