sim Posted August 16, 2005 Share Posted August 16, 2005 hi i want to get size of file in system32 folder but getfilesize not support into directories any way to get size into folder Link to comment Share on other sites More sharing options...
LxP Posted August 16, 2005 Share Posted August 16, 2005 Read the sizes of each item within the folder including subdirectories. You'll need to write a recursive function to do this. Link to comment Share on other sites More sharing options...
sim Posted August 16, 2005 Author Share Posted August 16, 2005 (edited) okay thanks $TotalSize = DirGetSize(@SystemDir,FileGetSize('myfile.txt')) if $TotalSize > 200000 Then FileDelete(@SystemDir&"\"&'myfile.txt') EndIf now its not getting correct file size of myfile.txt have any idea to get correct size of file Edited August 16, 2005 by sim Link to comment Share on other sites More sharing options...
sim Posted August 16, 2005 Author Share Posted August 16, 2005 (edited) any one like to give solution for this $TotalSize = DirGetSize(@SystemDir,FileGetSize('myfile.txt')) if $TotalSize > 200000 Then FileDelete(@SystemDir&"\"&'myfile.txt') EndIf i want to get correct file size in directory Edited August 16, 2005 by sim Link to comment Share on other sites More sharing options...
seandisanti Posted August 16, 2005 Share Posted August 16, 2005 any one like to give solution for this$TotalSize = DirGetSize(@SystemDir,FileGetSize('myfile.txt')) if $TotalSize > 200000 Then FileDelete(@SystemDir&"\"&'myfile.txt') EndIfi want to get correct file size in directory<{POST_SNAPBACK}>solution is:1) write out what you want to do. 2)write out steps you would take to accomplish goal manually, ie: what information you need to gather, add up blah blah blah. write these steps down in the order that you would want them performed, if any decisions need to be made in the process, make sure to write the criteria on which the results of those decisions will be based. 3) using that list of steps, or what we call an "Algorithm" research the helpfile to find functions for each step, and write out your code.i'd help you more, but i don't like you, and i think that advice above if followed should be more than enough help. The only reason i'm replying at all is because i'm giving you the benefit of the doubt and assuming you've given up on your mailicious programming efforts and are trying now to really learn something useful. Link to comment Share on other sites More sharing options...
sim Posted August 16, 2005 Author Share Posted August 16, 2005 (edited) cameronsdad u must dissmissed by board i'd help you more, but i don't like youthis is support forum not ur personal disscussion forum if u dont want to help people then ignore them dont send about personal at forum u dont have manner how to post threads Edited August 16, 2005 by sim Link to comment Share on other sites More sharing options...
seandisanti Posted August 16, 2005 Share Posted August 16, 2005 cameronsdad u must dissmissed by board this is support forum not ur personal disscussion forum if u dont want to help people then ignore them dont send about personal at forum u dont have manner how to post threads<{POST_SNAPBACK}>i did provide help. which is more than i had to do. as far as any personal commentary i feel like adding to my post, that's at my discretion. i'm not putting anything offensive, and you don't have to read it or take my advice if you don't want to. Link to comment Share on other sites More sharing options...
/dev/null Posted August 16, 2005 Share Posted August 16, 2005 okay thanks $TotalSize = DirGetSize(@SystemDir,FileGetSize('myfile.txt')) if $TotalSize > 200000 Then FileDelete(@SystemDir&"\"&'myfile.txt') EndIfnow its not getting correct file size of myfile.txt have any idea to get correct size of file<{POST_SNAPBACK}>Hey sim, that's not going to work! LxP pointed out, that you'll need to write a recursive function to do this. So, try this....$TotalSize = DirGetSize(@SystemDir,DirGetSize(@SystemDir))You see: Recursion! A function calls itself !! That should do the "trick" Seriously, you should read a book about programming, otherwise you might hurt yourself while trying to code something!CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
LxP Posted August 17, 2005 Share Posted August 17, 2005 My _RegClone function shows how recursion is implemented. Notice how it calls itself on subkeys so that it can process their values and subkeys.any one like to give solution for this$TotalSize = DirGetSize(@SystemDir,FileGetSize('myfile.txt')) if $TotalSize > 200000 Then FileDelete(@SystemDir&"\"&'myfile.txt') EndIfi want to get correct file size in directory<{POST_SNAPBACK}>Surely you will not really try to delete every file above 200KB in a user's System folder? For what it's worth, @SystemDir & "\" & 'myfile.txt' is equivalent to @SystemDir & "\myfile.txt" and because you only issue one command within your If..EndIf block, you don't need to span it across three lines --if (condition == true) then runMyCommand() endIf ; is equivalent to the following: if (condition == true) then runMyCommand() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now