Re: NSFIleManager enumeratorAtPath problem



MacOS 10.13.6
Deployment Target 10.13

Yes, they are real folders, here is one that doesn’t work:


This has a number of .xls files and a couple of .pdf files.


On 6 Jun 2019, at 13:06, Dave <dave@...> wrote:

As I said,

myExistsFlag and myFolderFlag are set to YES.

So the folder exists, I copied and pasted the Path from the finder. Also I've tried it on a number of different folders and it still doesn’t work. There are definitely files present in the folders I’ve tried.


On 6 Jun 2019, at 12:27, Sak Wathanasin <sw@...> wrote:

Can anyone spot the problem

In the code you posted, there was no check for the value of myFolderFlag
on return from fileExistsAtPath:, so are you sure it's a directory? Doc
for enumeratorAtPath: says:

"Return Value
An NSDirectoryEnumerator object that enumerates the contents of the
directory at path.

If path is a filename, the method returns an enumerator object that
enumerates no files—the first call to nextObject will return nil."

Sak Wathanasin
Network Analysis Ltd

Join to automatically receive all group messages.