Questions tagged [nsfilemanager]

The NSFileManager class enables you to perform various generic file-system operations and insulates an application from the underlying file system.

An apple class reference.

A simple file handling

//Gives you document folder detail

    NSFileManager *fileManager = [NSFileManager defaultManager];
    [fileManager setDelegate:self];
    NSError *error;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSArray *newfilelist=[fileManager contentsOfDirectoryAtPath:documentsDirectory error:&error ];

//gives your file is file or directory

NSString *path = @"/Users";
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSLog(@"fileManager=%@", fileManager);
    BOOL bDirectory;
    BOOL bExists = [fileManager fileExistsAtPath:path isDirectory:&bDirectory];
    NSLog(@"%@: bExists=%d bDirectory=%d", path, bExists, bDirectory);
1400 questions
-1
votes
1 answer

Loading image from folder using NSBundle and plist

Trying to Display the load the image from the folder present on MAC desktop using path like (/Users/sai/Desktop/images/aaa.jpg) Which is created in plist file called Data.plist at item0. As im using NSBundle it is diaplying the image path but not…
lreddy
  • 391
  • 4
  • 17
-1
votes
1 answer

Can't Create a new file using NSData writeFile, NSFileManager and NSURL never returns the filePath

am working over an iOS App and am having a huge bad time over this issue, here is the thing: 1.- Am creating a file based on some NSData 2.- Am trying to retrieve the NSURL of that new file that i just created the issue is that the NSURL doesn't…
-1
votes
2 answers

Can i make a html file in Documents directory which accesses jquery and cordova in the app bundle?

I am building a html file which is stored in [[PROJ UserDirectory] stringByAppendingPathComponent:@"tmp_Form_File.html"] and inside of the file "tmp_FOrm_File.html" it is being dynamically built. Body shows up correctly but the JS will not…
Fallenreaper
  • 8,518
  • 10
  • 53
  • 107
-1
votes
1 answer

display file properties in nstableview

I want to display files' data in a tableview . Files are stored in a directory. I want to display in the tableview : the icon , name , size and the date of the files. Thanks to NSFileManger , I found how to display directory's content ,but I can't…
Wael
  • 73
  • 5
-2
votes
2 answers

Deleting/Overwriting Image files on iphone obj c

I am attempting to delete or overwrite an image within a specific directory. I grab all my images in an array and place in a table view. When an image is clicked photo roll is opened and the user chooses an image. when the imagepicker controller is…
FreeAppl3
  • 858
  • 1
  • 15
  • 32
-2
votes
0 answers

How to implement the NAS Drive in angular 8?

I am working on one application and want's to implement the NAS Drive to access the local files and folders from application. I am using following technologies. Front End: Angular 8 Backend: Java
-2
votes
1 answer

Swift How to get the count of audio files in a folder inside the project manager

I have a BIG folder with dozens of folders inside, with a couple of audio files inside each folder. I need to get the count of audio files in every one of those sub folders (e.g. AppName/AudioFiles/ThirdFolder/(I need the count of all the audio…
-2
votes
1 answer

Incorrect method suggestion by Xcode

I am trying to create a directory in my OS X app. The method was suggested as I started typing. But the method seems to be incorrectly suggested. The attributes parameter of the method in NSFileManger normally takes a [FileAttributeKey:Any]…
Aravind G S
  • 370
  • 2
  • 17
-2
votes
2 answers

How to open local file in a view controller

I have an application which downloads file from the server. i want to open these files present in the file system in a new view controller. What can I do to open the files without using web view
Amon
  • 99
  • 1
  • 9
-2
votes
2 answers

Read/Write .string files from/to Directory

I have a framework that expects a .string file from the Project that it is imported to. How do I save a .string file from my app's [NSBundle mainBundle] to NSLibraryDirectory, and then have the framework read it from NSLibraryDirectory? Thank you
aalesano
  • 357
  • 2
  • 13
-2
votes
2 answers

UIImage saved to Document Directory returning nil

NSDocumentDirectoryI'm new to iOS. Im trying to build a simple app to better grasp Core Data and the file system. I can't retrieve data that I've apparently stored. -I check to see if the file exists at the path, which it does, but when I try to…
got2jam
  • 280
  • 2
  • 10
-2
votes
3 answers

How to filter array and let stay only strings end with .png

I am reading files from folder, folder contains .pngs but I get additionally Thumb.db file in every folder and all others are .pngs. I read content as NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path…
PaolaJ.
  • 9,104
  • 19
  • 62
  • 100
-2
votes
1 answer

contentsOfDirectoryAtPath returning nil

I have a folder with a bunch of images named “Pictures” right inside “Supporting Files”, but when I try to retrieve the files it returns nil, even though I'm sure there are images inside; I try to do it with the following code inside…
-2
votes
1 answer

Could not create new directory in iOS 7

I am not able to create a new directory in my application's folder (iOS 7), Am using this code... NSFileManager *filemgr; NSArray *dirPaths; NSString *docsDir; NSString *newDir; filemgr =[NSFileManager defaultManager]; …
AC Mohan
  • 33
  • 1
  • 4
-2
votes
1 answer

Objective-C, Determining File Sizes Programmatically

I'm trying to include a method in my application that determines the size of a file such as: file.txt, file.app, file.png, etc. I have general idea of how to do this, tried the following, but my app crashes because of the NSLog function at the…
Joe Habadas
  • 588
  • 7
  • 21
1 2 3
93
94