Page 1 of 1

File size in a TI

Posted: Sat Jul 20, 2013 8:44 am
by Darkhorse
Hi all

Im writing a maintenance TI that checks for Files in the server folder. I can count them, using scan i can define them but is there anyway to get the file size? or second to this any way i can get the folder size as well?

Thanks all

Re: File size in a TI

Posted: Sat Jul 20, 2013 9:54 am
by Wim Gielis
Hello there

I'm not sure there's a direct way in TI. If yes, I would like to know about it too.
What I did in the past, was create a VBS file, execute that file with TI, let the VBS create a text file, and pick up the file again in the next TI process.

Wim

Re: File size in a TI

Posted: Sat Jul 20, 2013 10:09 am
by Darkhorse
hi wim,

I too built a Excel VB document to do this however im trying to move away from the need to run macros and automate my Maintenance via chores

Re: File size in a TI

Posted: Sat Jul 20, 2013 11:22 am
by Wim Gielis
What I suggested above, is no Excel and macros, and can be automated through chores.

Re: File size in a TI

Posted: Sat Jul 20, 2013 12:49 pm
by tomok
Darkhorse wrote:Hi all

Im writing a maintenance TI that checks for Files in the server folder. I can count them, using scan i can define them but is there anyway to get the file size? or second to this any way i can get the folder size as well?

Thanks all
You can get a file listing with sizes by issuing a DIR command in a TI process. You can then parse that file in a second TI. There are a bunch of parameter options you can provide to the DIR to get the file in the format you want. To get all the files in a data directory and all subfolders and files you could do this:

Code: Select all

CommandLine = 'cmd /c dir /s *.* >File_Listing.txt';
ExecuteCommand(CommandLine, 0);
This will produce a file list in the default directory in TM1. If your data folder is not the default you may need to provide a folder to the DIR command. A second TI can parse File_Listing.txt, creating a File dimension and writing the particulars of each file to a cube.

Re: File size in a TI

Posted: Sat Jul 20, 2013 5:57 pm
by Darkhorse
Brilliant i like it

thanks guys :D