![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2006
Posts: 13
Rep Power: 0
![]() |
Sorting By File Size
I'm running VB6 and am working on a program and I'm trying to have it sort through a folder and take all files larger than X amount of megabytes and rename them and copy them, my question is how do I get the program to sort the files based on size and work with only those?
Thanks |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
You need to grab an array containing the directory's contents, and iterate through it until it finds a file greater then X amount of megabytes. Once it finds this file, it runs the required commands with it, and then continues looping until it's gone through the entire array.
I don't see where sorting becomes necessary in this, but in case I misunderstood one side to your question, here is a tutorial for multiple sorting algorithms implemented in Visual Basic: http://www.vb-helper.com/tut1.htm |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jan 2006
Posts: 13
Rep Power: 0
![]() |
thanks alot that is what I meant. But how do I tell Visual Basic what the minimum size is, like how do I take a file and get in integer value as the file size?
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() |
Here's some code that searches for files and displays their size in a listbox: http://www.vb-helper.com/howto_total_file_sizes.html
From that you can take the command for getting the file size. From what I see, you have to use the method "nFileSizeHigh" on a file handle. This may not be the simplest way to do it. Just do some searching around, you'll find something. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|