Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have a storage server with each user having a dedicated folder with set size limits.
I have been asked if it is possible to to interrogate the server using QlikView and produce a report showing folder name, used space, folder limit and free space...
Unsure where to start with this...
Has anyone else tackled something like this before?
It's definitely possible. You would need to create a loop (see For loops in the Help file) to query your folders. Then you would need to use the filesize() function to check each filesize in your folder. Add all the file sizes together and you get the total size of the folder. Folder name can be fetched with the filepath() function. Hardcode the HD size and subtract all folder sizes and you get the free space. It's a pain, but it's possible to do. To be honest, you might want to use a different tool since this is not really where QV shines...
Regards,
Ease,
Create a .BAT file like below
dir /S <yourpath> > file.txt
and then read the "file.txt" inside your app
For free space, you can use this macro:
sub DriveFreeSpace
drive="C:"
call ShowFreeSpace(drive)
end sub
'
Function ShowFreeSpace(drvPath)
Dim fso, d, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvPath))
s = "Drive " & UCase(drvPath) & " ("
s = s & d.VolumeName & ") "
s = s & "free space: " & FormatNumber(d.FreeSpace/1024/1024, 0)
s = s & " MBytes"
ShowFreeSpace = s
msgbox(ShowFreeSpace)
End Function