开发者

how to read a file from folder without giving filename , in objective c

I am moving a file to a folder ( file is stored in other folder), I am moving it by giving the file name, but I want to move all files, which r stored in a folder to some other folder.

How can I do this ?

Thanks in advance.

-(void)MoveFilesToMyInBoxFolder:(NSString *)destfileName

{

NSString* fullPath = [[NSBundle mainBundle] pathForResource:[destfileName stringByDeletingPathExtension]  ofType:@"xml"];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

if (!documentsDirec开发者_JS百科tory) {
    NSLog(@"ERROR:Documents directory not found!");
    return;
}

i am calling this method like

[self MoveFilesToMyInBoxFolder:@"QS-H02032011100717AM1.xml"];


Using contentsOfDirectoryAtPath method of NSFileManager you can get an array of file names of all items within a directory. You can iterate through this array and move each item.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜