Folder File Size

Folder File Size

Page 1 of 1

11 Replies - 11114 Views - Last Post: 25 October 2006 - 06:32 AM Rate Topic: -----

#1 Inter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-October 06

Folder File Size

Posted 07 October 2006 - 01:47 PM

Hi, i got an little question im stuck on.

How can i get the size of an folder?
Do i need to loop all the files in the folder somehow?, if so how?

Best Regards
/Inter
Is This A Good Question/Topic? 0
  • +

Replies To: Folder File Size

#2 gregoryH  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 60
  • View blog
  • Posts: 656
  • Joined: 04-October 06

Re: Folder File Size

Posted 07 October 2006 - 10:51 PM

Hi

First:
Which C++ compiler are you using?

Second:
Do you want to use the std library, WIN32 API or MFC/VCL?

There isn't a third question, so its not the inquisition....

Regardless of the compiler, this is the sort of problem that can be solved in either a recursive or procedural manner.

Talk to me
Was This Post Helpful? 0
  • +
  • -

#3 Xing  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 19
  • View blog
  • Posts: 725
  • Joined: 22-July 06

Re: Folder File Size

Posted 07 October 2006 - 10:56 PM

OS? Language- C or C++? Compiler?
Was This Post Helpful? 0
  • +
  • -

#4 gregoryH  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 60
  • View blog
  • Posts: 656
  • Joined: 04-October 06

Re: Folder File Size

Posted 07 October 2006 - 11:29 PM

ok - now its three questions....
Was This Post Helpful? 0
  • +
  • -

#5 Inter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-October 06

Re: Folder File Size

Posted 08 October 2006 - 10:05 AM

thanks for reply guys

I use MVC++ 6.0
I have Windows XP Pro
Will code it in WinAPI C++

Best Regards Inter
Was This Post Helpful? 0
  • +
  • -

#6 Xing  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 19
  • View blog
  • Posts: 725
  • Joined: 22-July 06

Re: Folder File Size

Posted 08 October 2006 - 11:15 AM

You can use GetFileSize() which needs a handle to folder or open file.
Was This Post Helpful? 0
  • +
  • -

#7 violent_crimson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 31-August 06

Re: Folder File Size

Posted 08 October 2006 - 06:49 PM

http://msdn.microsof...getfilesize.asp
Was This Post Helpful? 0
  • +
  • -

#8 Inter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-October 06

Re: Folder File Size

Posted 09 October 2006 - 07:49 AM

hi thx for reply.

I still having trouble to get my folder as handle, and if i try with CreateFile, to get the folder as handle and use GetFileSize on that handle, i get result -1?

Best Regards Inter
Was This Post Helpful? 0
  • +
  • -

#9 Xing  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 19
  • View blog
  • Posts: 725
  • Joined: 22-July 06

Re: Folder File Size

Posted 09 October 2006 - 08:03 AM

and your code is?
Was This Post Helpful? 0
  • +
  • -

#10 Inter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-October 06

Re: Folder File Size

Posted 10 October 2006 - 11:15 AM

Here is the code


HANDLE hnd_folder = CreateFile("folder1",GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
DWORD size = GetFileSize(hnd_folder,NULL); 


thanks

/Inter
Was This Post Helpful? 0
  • +
  • -

#11 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: Folder File Size

Posted 11 October 2006 - 09:44 AM

That is because folder1 is being created as a file, not a folder....
I get the result as 0..and not -1.
Was This Post Helpful? 0
  • +
  • -

#12 Inter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-October 06

Re: Folder File Size

Posted 25 October 2006 - 06:32 AM

Hi again.
Cant get this working...
Can anyone paste me a code snippet?
thx Inter
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1