View the file list of iOS development

Source: Internet
Author: User

Haha, I am a newbie. The following describes how to view the file list in iOS development.

View the file list in the root directory

 
 
  1. NSArray *leveList= 
  2.  [[[NSFileManager alloc]init] contentsOfDirectoryAtPath: [NSHomeDirectory() stringByAppendingPathComponent:@""]                                                                          error:nil]; 
  3.   for (NSString *str in leveList) { 
  4.      NSLog(@"levelList:%@",str); 
  5.  } 
  6.  NSLog(@"count:%d",[leveList count] ); 

The results of the file list are as follows:

 
 
  1. 2013-06-14 16:18:14.513 helloword[853:c07] levelList:Documents 
  2. 2013-06-14 16:18:14.533 helloword[853:c07] levelList:helloword.app 
  3. 2013-06-14 16:18:14.534 helloword[853:c07] levelList:Library 
  4. 2013-06-14 16:18:14.535 helloword[853:c07] levelList:tmp 
  5. 2013-06-14 16:18:14.537 helloword[853:c07] count:4 

View the Library file list

 
 
  1.         NSArray *leveList= 
  2.       [[[NSFileManager alloc]init] contentsOfDirectoryAtPath: [NSHomeDirectory() stringByAppendingPathComponent:@"Library"]                                                                          error:nil]; 
  3. for (NSString *str in leveList) { 
  4.           NSLog(@"Library:%@",str); 
  5.       } 
  6.       NSLog(@"count:%d",[leveList count] ); 

The result is as follows:

 
 
  1. 2013-06-14 16:26:49.475 helloword[1040:c07] Library:Caches 
  2. 2013-06-14 16:26:49.478 helloword[1040:c07] Library:Preferences 
  3. 2013-06-14 16:26:49.480 helloword[1040:c07] count:2 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.