New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Smallest File Finder


Post Reply New Thread Subscribe

 
Thread Tools
faisaliqbal

 
Member Since: Apr 09, 2014
Posts: 15
faisaliqbal is on a distinguished road

faisaliqbal is offline
I am new to mac, I am trying to build a app which can display the smallest file in the system. Tell me some ideas how to do it?
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,687
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Moved to more appropriate forum.

Can you be a little more specific? Are you looking for all files or only files from a certain location on the filesystem? What language are you using?

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Personal Twitter
QUOTE Thanks
pigoo3

 
pigoo3's Avatar
 
Member Since: May 20, 2008
Location: U.S.
Posts: 25,812
pigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond reputepigoo3 has a reputation beyond repute
Mac Specs: 13" MB 2.4ghz, 2gig ram, OS 10.7.5

pigoo3 is offline
Quote:
Originally Posted by faisaliqbal View Post
Tell me some ideas how to do it?
If I told you...then I wouldn't get rich & famous!

- Nick

- Computer slow, too many "beachballs", read this: Beachballs
- Computer seems slower than it used to? Read this for some speedup tips: Speedup
- Almost full hard drive? Some solutions. Out of Space
- Apple Battery Info. Battery
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,687
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
You can leverage the command line for this one. Try adapting this to your needs.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Personal Twitter
QUOTE Thanks
Raz0rEdge

 
Raz0rEdge's Avatar
 
Member Since: Jul 17, 2009
Location: MA
Posts: 7,327
Raz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant futureRaz0rEdge has a brilliant future
Mac Specs: 27" i7 iMac, 24" iMac, 13" Macbook Air, iPhone 5 & 5S, iPod Nano 7th Gen, iPad 2 16GB WiFi, iPad 3

Raz0rEdge is offline
It's fairly simple..
Code:
In psuedo code:

Create data structure to hold
      size
      name
      directory

Open a directory
     Create instance of data structure and initialize to empty/NULL
     Get first entry
     Is it a directory?
          Recursively call yourself
     Is it a file?
          Determine the size of the file
          Is the data structure empty?
                Save all information of file in data structure
                Go to next file
          Compare size of this file to data structure data
          Is this file smaller?
                 Overwrite all information in data structure
                 Go to next file
          Go to next file
Close directory
Now read up on the API and implement..

--
Regards
...Ashwin



Be sure to read the Community Guidelines | The more information you provide, the better answers you get, remember GIGO.
QUOTE Thanks
faisaliqbal

 
Member Since: Apr 09, 2014
Posts: 15
faisaliqbal is on a distinguished road

faisaliqbal is offline
Quote:
Originally Posted by vansmith View Post
Moved to more appropriate forum.

Can you be a little more specific? Are you looking for all files or only files from a certain location on the filesystem? What language are you using?
reply: i am using objective-c language and trying to find smallest file in complete file system.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,687
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Raz0rEdge's psuedocode ought to get you started. This might also help.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Personal Twitter
QUOTE Thanks

Post Reply New Thread Subscribe


« xCode 5 Label, Button, etc help | working with file »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
PST file to MBOX file conversion +Mark Switcher Hangout 5 05-27-2014 04:06 AM
my file keeps becoming 'read only' paultilling OS X - Apps and Games 4 03-31-2014 12:42 PM
40,000 JPG / Tiff / PS file corrupted, damaged, will not open dscully4 OS X - Apps and Games 7 03-30-2014 08:38 PM
Brew, rsync and command line errors . . . TattooedMac OS X - Development and Darwin 11 03-26-2014 04:36 AM
The Official "How To Transfer Your iPod or iTunes Library to Your New Mac" Thread TheCustomer99 iPod Hardware and Accessories 64 02-26-2013 02:39 PM

All times are GMT -4. The time now is 04:43 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?