Re: paths for contents of a directory
Re: paths for contents of a directory
- Subject: Re: paths for contents of a directory
- From: Eric Jutras <email@hidden>
- Date: Tue, 15 May 2007 00:38:19 -0400
Have you tried NSFileManager's
- (NSDirectoryEnumerator *)enumeratorAtPath:(NSString *)path
?
On 15 mai 07, at 00:32, Roland Silver wrote:
Given a string directoryPath which is a path to a directory, is
there some simple way to iterate over the members of the directory
which yields not just the file name of the member, but its complete
path name?
With this code:
NSArray* directoryContents =
[[NSFileManager defaultManager]
directoryContentsAtPath:directoryPath];
NSString* path;
NSEnumerator *enumerator = [directoryContents objectEnumerator];
while (path = [enumerator nextObject]) {
...
}
the variable "path" (surprisingly) is bound to the file names of
the successive entries of the directory, rather than to their path
names -- which are what I need to extract the contents of the files
in the directory.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden