nsfilemanager Questions
3
I’m trying to get the names of all files and folders in an iCloud Drive directory:
import Foundation
let fileManager = FileManager.default
let directoryURL = URL(string: "folderPathHere")!
do {
...
Cattalo asked 8/4, 2020 at 20:0
4
Solved
How is possible to find quickly the document folder (in the mac) of an App when I'm using the simulator? When I need to explore the document folder during the simulation of the App now I use a vari...
Kaciekacy asked 12/3, 2016 at 22:11
6
In my iPhone app I am using the following code to find a file's size. Even though the file exists, I am seeing zero for the size.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDire...
Perretta asked 21/4, 2011 at 12:8
3
Solved
How is it possible?
let exists = NSFileManager.defaultManager().fileExistsAtPath(path.absoluteString)
print("exists: \(exists)") //false
This is path.absoluteString
//file:///Users/kuna/Library...
Dillingham asked 7/12, 2015 at 13:56
19
Solved
I'm looking for a better way to detect available/free disk space on the iPhone/iPad device programmatically.
Currently I'm using the NSFileManager to detect the disk space. Following is the snippet...
Crucifer asked 19/4, 2011 at 6:38
4
Solved
How can I check if a file exists at a URL (instead of a path), in order to set a pre-populated default store into the iPhone Simulator:
NSURL *storeURL = [[self applicationDocumentsDirectory] URL...
Preciado asked 24/10, 2011 at 16:33
10
Solved
I'm looking for a way to make sure a string can be used as a file name under iOS. I'm currently in the section of the code that deletes incompatible characters. I'm wondering if I'm doing it right....
Cheyennecheyne asked 23/5, 2011 at 20:0
6
Solved
I am trying to get the size of a directory, as well as it's content on OS X using Swift. So far, I have only been able to get the size of the directory itself, with none of it's content. For ...
Strident asked 28/9, 2015 at 1:19
9
Solved
I'm having some trouble with converting Objective-C code to create a directory for Swift.
Objective-C:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,...
Diocese asked 14/11, 2014 at 13:42
10
Solved
I'm using this method to copy a file:
[fileManager copyItemAtPath:sourcePath toPath:targetPath error:&error];
I want to overwrite a file when it exists already. The default behavior of this ...
Thickset asked 26/5, 2011 at 10:57
7
Solved
I've found this way of creating a directory if it does not exist. But it looks a bit wonky and I am afraid that this can go wrong in 1 of 1000 attempts.
if(![[NSFileManager defaultManager] fileExi...
Plasty asked 25/5, 2011 at 14:13
3
Solved
I want to use the octal permissions (used for chmod) for NSFilePosixPermissions.
Here is what I did now:
NSFileManager *manager = [NSFileManager defaultManager];
NSDictionary *attributes;
[attrib...
Ruben asked 11/3, 2012 at 13:6
3
Solved
I am attempting to create an array of URLs for all of the resources in a sub-directory in my iOS app. I can not seem to get to the correct path, I want to be able to retrieve the URLs even if I do ...
Unmanly asked 24/4, 2018 at 14:44
10
Solved
I'm trying to find the creation date (NOT modification date) of a file.
Creation date doesn't appear to be in the attributes of a file, though modified date is.
I'm using this code..
NSFileManag...
Hierarch asked 21/1, 2010 at 11:55
3
Solved
I want to move a file, in OSX, to another directory:
func moveFile(currentPath currentPath: String, targetPath: String) {
let fileManager = NSFileManager.defaultManager()
do { try fileManager.mo...
Flint asked 2/10, 2015 at 18:10
3
let data = "InPractiseThisWillBeAReheallyLongString"
createDir()
let docsDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let ourDir = docsDir.a...
Ekaterina asked 18/10, 2017 at 15:40
2
Solved
When I update my iOS app, I want to delete any existing sqlite databases in the Documents directory. Right now, on an application update, I copy the database from the bundle to the documents direct...
Ewens asked 12/2, 2013 at 16:32
9
Solved
I have created a Temp directory to store some files:
//MARK: -create save delete from directory
func createTempDirectoryToStoreFile(){
var error: NSError?
let paths = NSSearchPathForDirectoriesI...
Juliojulis asked 29/9, 2015 at 9:13
6
Solved
Following my program shows contents of Documents directory and is displayed in a tableView .
But the Documents directory contains some directories , some audio , some video , and some images etc . ...
Pucker asked 17/6, 2013 at 10:57
3
Solved
Hi I have a whole bunch of .mp3 files I want to use with NSFileManager and store in the documents folder. Is there a way I can download the .mp3 files online and then have it save to the documents ...
Lenticularis asked 18/12, 2014 at 5:55
1
Imagine this simple example of two paths on macOS:
/etc/hosts
/private/etc/hosts
Both point to the same file. But how do you determine that?
Another example:
~/Desktop
/Users/yourname/Desktop
O...
Subjunction asked 6/4, 2021 at 12:12
7
Solved
I am developing an iPhone photo application, so i need to create a separate album with a name "My Album" in camera roll and i need to save my UIImageView image with custom name for example "My Imag...
Salomon asked 28/8, 2012 at 3:37
3
Solved
I have a few items that are saved to the documents directory. I currently need those to be moved programmatically to another directory. I created the new directory successfully, but it doesn't seem...
Gunning asked 25/4, 2018 at 1:13
3
I have long been using +[NSURL fileURLWithPath:] because it's convenient, but in profiling I found that this was a source of bottlenecks because it queries the filesystem before calling down to +[N...
Tap asked 6/9, 2013 at 19:39
3
Solved
My iOS app can open CSV files, in order to import their data. I can open files from within the app via a UIDocumentPickerViewController with no issues, selecting a file shown in the Files app. Howe...
Azotobacter asked 30/1, 2019 at 23:24
1 Next >
© 2022 - 2024 — McMap. All rights reserved.