Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Sizes of all the files inside the sub folders of the directories

Hi All,

We are making use of DIRUSE.exe in the following way to get the space details of the directories. But the problem is we are unable to file the filesize of the files in the last folder. It just gives the space details of all the subfolders. Could you please help me out to find out the space details of the files inside the subfolders.

E:\QlikView\DIRUSE /s/m E:\QlikView\Data > E:\QlikView\Data\Size.txt

Size.txt contains sizes of all the sub folders inside E:\QlikView\Data. Header of the output is something like below.

Size(mb) Files Directory


Please help me out on this...

18 Replies
DavidFoster1
Specialist
Specialist

Why are you using DIRUSE? My first thoughts is that QlikView has its own File functions that should allow you to do exactly what you are trying to do. In particular there is an option in FOR NEXT to call a filelist which I use extensively in incremental file loading.

qlikviewforum
Creator II
Creator II
Author

We are already using DIRUSE which is very simple way to fetch the space details in a txt. Using QV functions it may be cumbersome. So it would be great if we can get the details using the DIRUSE.exe itself.

Bill_Britt
Former Employee
Former Employee

Hi,

Take a look at this.

Untitled.png

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
qlikviewforum
Creator II
Creator II
Author

Ok thank you, but may I know how you managed to get the output?

swuehl
MVP
MVP

Have a look at the script of the QV application that Bill attached to his post.

If you can't open the application, the essential part looks like

SET FilePath='Logfiles\A2002_01*.asc';

sub DoDir (Dir)

set NoOfFiles = 0;

//Loop through all files in the directory to check if there are any files beginning with

//"A2002_01" and extension ".asc" in the sub folder "Logfiles".

//For each "A22002_01" file that is found, the variable NoOfFiles will be increased by 1.

for each File in filelist (Dir&'\'&'$(FilePath)')

    let NoOfFiles = NoOfFiles + 1;

   

    Load

        '$(File)' as Name,

        FileSize('$(File)') as Size,

        FileTime('$(File)') as FileTime

    autogenerate 1;

   

    next File

end sub;

//Call the procedure "DoDir" to check for files in this directory.

call DoDir ('C:\proj\QlikAcademy\AdvancedGroup\ControlStructures\DoDir');

qlikviewforum
Creator II
Creator II
Author

Hi Swuehl,

I couldn't see the attachment before. Not sure why!

By the way is there is any easy way to get the required data using batch program. As using QV function may be time consuming thats the reason I am trying to avoid that.

qlikviewforum
Creator II
Creator II
Author

FYI, Using the below batch command managed to list down the list of files but only problem here is it is not showing the file size

DIR /S/B/A <<Directory Path>>

Please help!

swuehl
MVP
MVP

Yes, that's because of the /b argument.

I am giving up on this thread. I've already posted above how you can use DIR to get a list of files incl. file sizes (though the format might not as you want it to be). I've also posted some links to forums where I think you should post questions related to Windows scripting.

You also got a script on how you can do this the QV way.

I can't see why using a small QV script to read in file sizes should take too much time, but anyway, it's up to you how you want to implement things.

Good luck!

qlikviewforum
Creator II
Creator II
Author

Thanks for all your help. Sorry if I haven't taken your instructions. I did tried using the QV Script but it is taking lots of time as it need to read almost 2TB space details. So gave up using it. Truly speaking while using the batch program it is not taking that much time.

So it would be great if you can suggest me using the batch files. If /b is the problem here I would like to know what is the command I should use. Anyway as sugested I will try to post in Microsoft forum for this.

Thanks again!