Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I found this macro for fidning the parent directory size but how should i find out the size of sub folders in the parent directory
Try with this macro
SUB DoDir (Root)
FOR Each Ext in 'qvw', 'qva', 'qvo', 'qvs'
FOR Each File in filelist (Root&' \*.' &Ext)
LOAD
'$(File)' as Name,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
NEXT File
NEXT Ext
FOR Each Dir in dirlist (Root&' \*' )
call DoDir (Dir)
NEXT Dir
ENDSUB
CALL DoDir ('C:')
Dear Tejaswini,
I'm sure you are looking for this one,
/*********************************************************************/
SUB GetFiles(vPath)
For each vFile in FileList('$(vPath)\*.Q*')
Files:
Load
'$(vPath)' as Folder,
'$(vFile)' as File,
FileSize('$(vFile)') As FileSize,
FileTime('$(vFile)') As FileTime
AutoGenerate(1);
Next
End Sub
SUB GetSubFolders(vPath)
For each vDir in DirList('$(vPath)\*')
Folders:
Load
'$(vDir)' As Folder
AutoGenerate(1);
Call GetFiles('$(vDir)');
Call GetSubFolders('$(vDir)');
Next
End Sub
Call GetFiles('c:\Program Files\QlikView');
Call GetSubFolders('c:\Program Files\QlikView');
/*********************************************************************/
Reference: QlikView for Developers Cookbook by Stephen Redmond
Kind regards,
Ishfaque Ahmed
Dear Tejaswini,
Please try this one,
SET vFileName = 'C:\YourFileName.qvd';
LET vFileSize = FileSize(vFileName);
TRACE FileSize: $(vFileSize);
Reference link,
QlikTip #31: Access Qvd Meta Data programmatically without using QlikView but pure .net & C#
Kind regards,
Ishfaque Ahmed
Amend your load statement like:
LOAD
SubField('$(File)', '\', -1) as Name,
'$(Root)' As Folder,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
Now you have a field called Folder which you can use as a dimension with Sum(Size) as the expression.
Hi Jonathen,
this working out but i want the folders size to come out in the way like
parent folders in one field and suv parent folders in one field and the next field and so on
for example:
a->b->c->d
e->f->g->h
i->j->k->l
m->n->o->p
all the names a,e,i,m the main parents in one folder,
b,f,j,n in one field and so on c,g,k,o i another and d,h,l,p i ina nother field and their respective sizes.
Dear Tejaswini,
I'm sure you are looking for this one,
/*********************************************************************/
SUB GetFiles(vPath)
For each vFile in FileList('$(vPath)\*.Q*')
Files:
Load
'$(vPath)' as Folder,
'$(vFile)' as File,
FileSize('$(vFile)') As FileSize,
FileTime('$(vFile)') As FileTime
AutoGenerate(1);
Next
End Sub
SUB GetSubFolders(vPath)
For each vDir in DirList('$(vPath)\*')
Folders:
Load
'$(vDir)' As Folder
AutoGenerate(1);
Call GetFiles('$(vDir)');
Call GetSubFolders('$(vDir)');
Next
End Sub
Call GetFiles('c:\Program Files\QlikView');
Call GetSubFolders('c:\Program Files\QlikView');
/*********************************************************************/
Reference: QlikView for Developers Cookbook by Stephen Redmond
Kind regards,
Ishfaque Ahmed