1. Common Nsfilemanager File methods
-(NSData *) Contentsatpath:path//Read data from a file
-(BOOL) Createfileatpath:path contents: (NSData *) data attributes:attr//write to a file
-(BOOL) Removeitematpath:path error:err//Delete a file
-(BOOL) Moveitematpath:from topath:to error:err//rename or move a file (to cannot be existing)
-(BOOL) Copyitematpath:from topath:to error:err//Copy file (to cannot be existing)
-(BOOL) Contentsequalatpath:path andpath:path2//Compare the contents of two files
-(BOOL) Fileexistatpath:path//test file exists
-(BOOL) Isreadablefileatpath:path//test file exists and can perform read operations
-(BOOL) Iswriteablefileatpath:path//test file exists, and can perform write operations
-(Nsdictionary *) Attributesofitematpath:path error:err//Get the properties of the file
-(BOOL) setattributesofitematpath:attr error:err//Change the properties of a file
2. Using the Catalog
-(NSString *) Currentdirectorypath//Get current directory
-(BOOL) Changecurrentdirectorypath:path//Change the current directory
-(BOOL) Copyitematpath:from topath:to error:err//Copy directory structure (to cannot be existing)
-(BOOL) Createdirectoryatpath:path withintermediatedirectories: (BOOL) flag ATTRIBUTE:ATTR//Create a new directory
-(BOOL) Fileexistatpath:path isdirectory: (bool*) flag//test file is not a directory (flag stored results yes/no)
-(Nsarray *) Contentsofdirectoryatpath:path error:err//List Contents
-(Nsdirectoryenumerator *) Enumeratoratpath:path//Enumerate the contents of the directory
-(BOOL) Removeitematpath:path error:err//Delete empty directory
-(BOOL) Moveitematpath:from topath:to error:err//rename or move a directory (to cannot be existing)
3. Common Path Tool method
+ (NSString *) pathwithcomponens:components//construct a valid path based on elements in components
-(Nsarray *) pathcomponents//destructor path for each part that makes up this path
-(NSString *) lastpathcomponent//Extract the last component of the path
-(NSString *) pathextension//extract its extension from the last component of the path
-(NSString *) Stringbyappendingpathcomponent:path//Add path to the end of an existing path
-(NSString *) Stringbyappendingpathextension:ext//Add the specified extension to the last component of the path
-(NSString *) stringbydeletinglastpathcomponent//Delete the last component of the path
-(NSString *) stringbydeletingpathextension//Remove the extension from the last part of the file
-(NSString *) Stringbyexpandingtileinpath//Expand the path to the user home directory (~) or the home directory of the specified user (~user)
-(NSString *) Stringbyresolvingsymlinksinpath//try to parse the symbolic link in the path
-(NSString *) Stringbystandardizingpath//by trying to parse ~ 、.. (parent directory symbol),. (current directory symbol), and symbolic link to standardize the path
4. Common Path Tool functions
nsstring* nsusername (void)//Returns the login name of the current user
nsstring* nsfullusername (void)//Returns the full user name of the current user
nsstring* nshomedirectory (void)//Returns the path of the current user home directory
nsstring* nshomedirectoryforuser (nsstring* user)//Return to user's home directory
nsstring* nstemporarydirectory (void)//Returns the path directory that can be used to create temporary files
5. Common iOS Directory
Documents (nsdocumentdirectory)//directory for writing application-related data files, files written here in iOS can be shared with itunes and accessed, files stored here are automatically backed up to the cloud
Library/caches (nscachesdirectory)///directory for writing application support files, save the information that the application needs to start again. itunes does not back up the contents of this directory
TMP (use Nstemporarydirectory ())//This directory is used to store temporary files, only the program terminates the need to remove these files, when the application no longer needs these temporary files, should be removed from this directory
Library/preferences//This directory contains the application's preferences file, using the Nsuserdefault class to create, read and modify the preferences file
iOS managing files and directories Nsfilemanager