• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTask and copying lots of small files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTask and copying lots of small files


  • Subject: NSTask and copying lots of small files
  • From: Jonathan Fewtrell <email@hidden>
  • Date: Sat, 28 Jan 2006 19:02:22 +0000

My app copies a directory from CD to the hard drive. The directory contains a few hundred small files (say 10k each).

If I use NSFileManager's copyPath method, the process is very slow. Several minutes to copy a directory that in total is only about 3MB. It is also rather nerve-wracking in that it makes the CD drive chatter throughout the process, presumably because it is seeking and copying one small file at a time. If I copy the directory in the Finder, the same thing happens.

However, if I use ditto from the Terminal, it all happens very smoothly in about 20 seconds with no chattering. So I tried using ditto via an NSTask:

- (BOOL)dittoFromPath:(NSString *)source toPath:(NSString *)target
{
NSTask *copyTask;
NSArray *arguments;
int outcome;

arguments = [NSArray arrayWithObjects:source, target, nil];
copyTask = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/ditto" arguments:arguments];
[copyTask waitUntilExit];
outcome = [copyTask terminationStatus];
return outcome == 0? YES : NO;
}


But this gives the same slowness and chattering as using NSFileManager.

If ditto is a separate process why shouldn't it run as efficiently when invoked from NSTask as it does when invoked from Terminal? Any other way I can get a smooth copying process?


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSTask and copying lots of small files
      • From: "Sean McBride" <email@hidden>
    • Re: NSTask and copying lots of small files
      • From: John Stiles <email@hidden>
    • Re: NSTask and copying lots of small files
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: Re: Graph/Chart UI widgets
  • Next by Date: Re: NSTask and copying lots of small files
  • Previous by thread: Re: Graph/Chart UI widgets
  • Next by thread: Re: NSTask and copying lots of small files
  • Index(es):
    • Date
    • Thread