Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 16th, 2006, 9:51 PM   #1
Steiner
Newbie
 
Steiner's Avatar
 
Join Date: Jan 2006
Posts: 13
Rep Power: 0 Steiner is on a distinguished road
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
Steiner is offline   Reply With Quote
Old Jun 17th, 2006, 12:51 AM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,188
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
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
Sane is online now   Reply With Quote
Old Jun 17th, 2006, 2:28 AM   #3
Steiner
Newbie
 
Steiner's Avatar
 
Join Date: Jan 2006
Posts: 13
Rep Power: 0 Steiner is on a distinguished road
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?
Steiner is offline   Reply With Quote
Old Jun 17th, 2006, 2:58 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,188
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
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.
Sane is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:04 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC