2
** IterateDirectory: File Manager directory iterator routines.
6
** File: IterateDirectory.h
8
** Copyright (c) 1995-1998 Jim Luther and Apple Computer, Inc.
9
** All rights reserved.
11
** You may incorporate this sample code into your applications without
12
** restriction, though the sample code has been provided "AS IS" and the
13
** responsibility for its operation is 100% yours.
15
** IterateDirectory is designed to drop into the MoreFiles sample code
16
** library I wrote while in Apple Developer Technical Support
19
#ifndef __RECURSEDIRECTORY__
20
#define __RECURSEDIRECTORY__
31
/*****************************************************************************/
33
pascal OSErr RecurseDirectory(short vRefNum,
35
ConstStr255Param name,
36
unsigned short maxLevels );
37
/* Iterate (scan) through a directory's content.
38
The IterateDirectory function performs a recursive iteration (scan) of
39
the specified directory and calls your IterateFilterProc function once
40
for each file and directory found.
42
The maxLevels parameter lets you control how deep the recursion goes.
43
If maxLevels is 1, IterateDirectory only scans the specified directory;
44
if maxLevels is 2, IterateDirectory scans the specified directory and
45
one subdirectory below the specified directory; etc. Set maxLevels to
46
zero to scan all levels.
48
The yourDataPtr parameter can point to whatever data structure you might
49
want to access from within the IterateFilterProc.
51
vRefNum input: Volume specification.
52
dirID input: Directory ID.
53
name input: Pointer to object name, or nil when dirID
54
specifies a directory that's the object.
55
maxLevels input: Maximum number of directory levels to scan or
56
zero to scan all directory levels.
57
iterateFilter input: A pointer to the routine you want called once
58
for each file and directory found by
60
yourDataPtr input: A pointer to whatever data structure you might
61
want to access from within the IterateFilterProc.
65
nsvErr -35 No such volume
67
bdNamErr -37 Bad filename
68
fnfErr -43 File not found
69
paramErr -50 No default volume or iterateFilter was NULL
70
dirNFErr -120 Directory not found or incomplete pathname
71
or a file was passed instead of a directory
72
afpAccessDenied -5000 User does not have the correct access
73
afpObjectTypeErr -5025 Directory not found or incomplete pathname
77
See also: RecurseFilterProcPtr, FSpRecurseDirectory
80
/*****************************************************************************/
82
pascal OSErr FSpRecurseDirectory(const FSSpec *spec,
83
unsigned short maxLevels);
84
/* Iterate (scan) through a directory's content.
85
The FSpIterateDirectory function performs a recursive iteration (scan)
86
of the specified directory and calls your IterateFilterProc function once
87
for each file and directory found.
89
The maxLevels parameter lets you control how deep the recursion goes.
90
If maxLevels is 1, FSpIterateDirectory only scans the specified directory;
91
if maxLevels is 2, FSpIterateDirectory scans the specified directory and
92
one subdirectory below the specified directory; etc. Set maxLevels to
93
zero to scan all levels.
95
The yourDataPtr parameter can point to whatever data structure you might
96
want to access from within the IterateFilterProc.
98
spec input: An FSSpec record specifying the directory to scan.
99
maxLevels input: Maximum number of directory levels to scan or
100
zero to scan all directory levels.
101
iterateFilter input: A pointer to the routine you want called once
102
for each file and directory found by
104
yourDataPtr input: A pointer to whatever data structure you might
105
want to access from within the IterateFilterProc.
109
nsvErr -35 No such volume
111
bdNamErr -37 Bad filename
112
fnfErr -43 File not found
113
paramErr -50 No default volume or iterateFilter was NULL
114
dirNFErr -120 Directory not found or incomplete pathname
115
afpAccessDenied -5000 User does not have the correct access
116
afpObjectTypeErr -5025 Directory not found or incomplete pathname
120
See also: RecurseFilterProcPtr, RecurseDirectory
125
/*****************************************************************************/
129
#endif /* __RECURSEDIRECTORY__ */