4 Copyright (C) 2000 Helge Hess.
7 Author: Helge Hess <helge.hess@mdlink.de>
10 This file is part of libFoundation.
12 Permission to use, copy, modify, and distribute this software and its
13 documentation for any purpose and without fee is hereby granted, provided
14 that the above copyright notice appear in all copies and that both that
15 copyright notice and this permission notice appear in supporting
18 We disclaim all warranties with regard to this software, including all
19 implied warranties of merchantability and fitness, in no event shall
20 we be liable for any special, indirect or consequential damages or any
21 damages whatsoever resulting from loss of use, data or profits, whether in
22 an action of contract, negligence or other tortious action, arising out of
23 or in connection with the use or performance of this software.
27 This is an example for using the NSFileManager class to remove
28 files in the filesystem.
31 #include <Foundation/Foundation.h>
33 int main(int argc, char **argv, char **env) {
39 #if LIB_FOUNDATION_LIBRARY
40 [NSProcessInfo initializeWithArguments:argv count:argc environment:env];
43 args = [[NSProcessInfo processInfo] arguments];
44 if ([args count] < 2) {
45 NSLog(@"usage: %@ <files>", [args objectAtIndex:0]);
49 fm = [NSFileManager defaultManager];
51 for (i = 1; i < [args count]; i++) {
52 NSString *path = [args objectAtIndex:i];
54 ok = [fm removeFileAtPath:path handler:nil];
56 NSLog(@"could not remove: %@", [args objectAtIndex:1]);