nadir.shpz
nadir.shpz

Reputation: 124

NSFileManager copyItemAtPath toPath

I wanna watch a folder, then copy different extensioned & same filenamed files to another directory/folder. But I check the files with

if([myManager fileExistsAtPath:[(NSURL*)pathSource path]]==YES

it detects ,return YES, there is file in directory.But never copied any of Video-Audio-txt files with

[myManager copyItemAtPath:@"/Users/.../CONTENTS/002BJ" toPath:@"/Users/.../CONTENTS/AUDIO/"; error:nil]

codes. So what's my wrong or Is there any another way to copy/move files to directories?

Upvotes: 0

Views: 1482

Answers (1)

Parag Bafna
Parag Bafna

Reputation: 22930

When a file is being copied, the destination path must end in a filename—there is no implicit adoption of the source filename.

NSString *path = @"/Users/.../CONTENTS/002BJ";
[myManager copyItemAtPath:path toPath:[@"/Users/.../CONTENTS/AUDIO/" stringByAppendingPathComponent:[path lastPathComponent] error:nil];

Upvotes: 1

Related Questions