0

我正在将文件移动到文件夹(文件存储在其他文件夹中),我通过提供文件名来移动它,但我想将存储在文件夹中的所有文件移动到其他文件夹。
我怎样才能做到这一点 ?
提前致谢。

-(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 (!documentsDirectory) {
    NSLog(@"ERROR:Documents directory not found!");
    return;
}

我把这个方法称为

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

1 回答 1

1

使用你的contentsOfDirectoryAtPath方法NSFileManager可以获得目录中所有项目的文件名数组。您可以遍历此数组并移动每个项目。

于 2011-02-08T07:38:57.993 回答