home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / os2ntree.zip / NTREE.MSS < prev    next >
Text File  |  1986-11-16  |  8KB  |  226 lines

  1. @Style(justify ON,margins 1 inch)
  2. @modify(description,indent -1 inch)
  3. @Majorheading(NTREE User's Guide)
  4.  
  5. @Section(Introduction)
  6.  
  7. This is a guide for using NTREE version 2.0, a very useful directory tree manipulation tool.  NTREE is capable of many functions, including:
  8.  
  9. @Itemize{
  10. Displaying directory listings recursively through the directory structure
  11.  
  12. Copying directory structures from one place to another
  13.  
  14. Deleting directory structures
  15.  
  16. Archiving directory structures into a single ARC file using the PD utility ARC
  17.  
  18. Totaling space used in a directory structure
  19.  
  20. Calling a DOS command for each file or directory (or both) in a directory structure
  21. }
  22.  
  23. There are many switches and options for NTREE, and not all of them may be useful for a given NTREE mode.  Each major NTREE command will be taken in turn, along with the switches that are appropriate with it.
  24.  
  25. @Section(NTREE command syntax)
  26.  
  27. The basic format of an NTREE command is as follows:
  28.  
  29. NTREE {switches} path1{wildcard}{switches} {path2}{switches} ...
  30.  
  31. The only required argument is a single directory path.  Directory paths specified may be in the following formats:
  32.  
  33.     \directory\directory...
  34.     drv:directory\directory...
  35.     drv:\directory\directory...
  36.     directory\directory...
  37.  
  38. The current drive and directory are inserted into the directory strings as appropriate.
  39.  
  40. Switches can be either single character or multi-character.  The multi character switch names are typically used by switches that aren't used so frequently.  Switches may be placed anywhere in an NTREE command (with one exception - see the CALL command)
  41.  
  42. A wildcard string may be used on the first pathname.  For example, to display all text files on the hard disk one might use:
  43.  
  44.     NTREE/A C:\*.txt
  45.  
  46. If a wildcard is placed on the second pathname, it is removed and ignored.
  47.  
  48. For those familiar with the old version of NTREE, you may notice that there is a pause before the program actually begins performing the command.  NTREE now reads the names of the directories it will be working with before it begins.  It is also capable (more or less) of telling when two trees intersect, avoiding the problems of copying a tree onto itself.
  49.  
  50. @Section(Directory Display operation)
  51.  
  52. NTREE's default mode is for directory displays.  That is, if you invoke NTREE with just a pathspec argument, all directories in the tree below the specified path will be written to stdout.
  53.  
  54. For example:
  55.  
  56.     NTREE C:\
  57.  
  58. will display the names of all the visible directories to stdout.
  59.  
  60. The switches that operate with the directory display are as follows:
  61.  
  62. @description{
  63. /A@/displays the names of the files in the directories (instead of just the directory names)
  64.  
  65. /DIR@/Displays the string "<DIR>" next to a filename if it is a directory.  This also causes directory names to appear in /A listings.
  66.  
  67. /I@/Displays information about the files (size, creation date).  This should usually be used with the /A switch.
  68.  
  69. /H@/includes hidden files and directories in the search.
  70.  
  71. }
  72.  
  73.  
  74. @Section(Copying directory structures)
  75.  
  76. NTREE's major purpose is to copy directory structures from place to place.  The main syntax for copying trees is:
  77.  
  78.     NTREE/C path1{wild} path2 {moreswitches}
  79.  
  80. So, to copy all the "C" files to the floppy from the hard disk, one would type:
  81.  
  82.     NTREE/C C:\*.C A:\
  83.  
  84. The switches that apply to the copy function are:
  85.  
  86. @Description{
  87. /H@/Copy hidden files too.
  88.  
  89. /Q@/Query before copying a file
  90.  
  91. /V@/Turn on DOS VERIFY switch while copying
  92.  
  93. /O@/Overwrite existing files
  94.  
  95. /U@/Copy only source files with archive bit set
  96.  
  97. /DATE@/Copy only source files with later dates than corresponding destination files
  98.  
  99. /YES@/Answer "YES" automatically to prompt for overwriting files
  100. }
  101.  
  102. @section(Deleting trees of directories)
  103.  
  104. NTREE can also destroy an entire tree of directories.  The syntax for this is:
  105.  
  106. NTREE/D path1{wild}
  107.  
  108. The switches that are used here are:
  109.  
  110. @Description{
  111. /YES@/Answer "YES" automatically to confirmation question
  112.  
  113. /H@/consider hidden files in search
  114.  
  115. /V@/Turn on DOS verify switch
  116. }
  117.  
  118.  
  119. @Section(Displaying space usage of a structure)
  120.  
  121. NTREE can tell you how much disk space is used by a particular structure on your disk.  The syntax is:
  122.  
  123. NTREE/T path{wild}
  124.  
  125. You can use a wildcard to only include certain files in your scan.  NTREE will display information in a format similar to the following:
  126.  
  127. Tree D:\*.* contains 74 files in 4 directories,
  128. 1061894 bytes (1037K)
  129. 2114 clusters for drive D:  (1057K)
  130. 2114 clusters for floppy drive:  (1057K)
  131.  
  132. The only useful switch here is /H, which causes NTREE to count hidden files in with the visible ones.
  133.  
  134. The number of clusters and amount of space are given both for the device the files were stored on, and the typical floppy drive.  This is useful for judging wether a collection of files will fit on a floppy.
  135.  
  136.  
  137. @Section(Archiving a collection of directories)
  138.  
  139. The public domain utility ARC is very useful for compressing a collection of files for archival, but it cannot deal with directory trees.  NTREE can call ARC to pack an entire structure into a single ARC file.  Suppose you had directories as follows:
  140.  
  141. D:\
  142. D:\INCLUDE
  143. D:\INCLUDE\SYS
  144. D:\LIB
  145.  
  146. by issuing the command:
  147.  
  148.     NTREE/ARC D:\ DRIVED.ARC
  149.  
  150. NTREE would create nested ARC files in the file DRIVED.ARC:
  151.  
  152. in DRIVED.ARC:
  153.     (other files in D:\ directory)
  154.     INCLUDE.ARC
  155.         (other files in INCLUDE directory)
  156.         SYS.ARC
  157.             (files in SYS directory)
  158.     LIB.ARC
  159.         (files in LIB directory)
  160.  
  161. There is no way at present to undo this, (except by hand)  A future NTREE will have a command to undo an ARC'd structure.
  162.  
  163. NTREE does not delete the tree as it proceeds.  You must have enough space on the device to hold the original files, the archives, and the temporary space used by ARC's cruncher.
  164.  
  165.  
  166. @Section(The NTREE call facility)
  167.  
  168. Sometimes it's not enough for NTREE just to be able to copy or delete structures.  Instead of building in all sorts of fancy tree manipulation routines, NTREE has a facility for calling existing MS-DOS programs throughout the directory tree.
  169.  
  170. The syntax for this is:
  171.  
  172. NTREE path1{wild} {path2} {/CALL "template"} {/BEFORE "template"} {/AFTER "template"}
  173.  
  174. The switches /CALL, /BEFORE, and /AFTER MUST be followed by a template string.  The position of the switch is important for determining the string's function.  Template strings should be in quotes, and separated from the switches and other parameters by spaces.
  175.  
  176. The /CALL template is used for each file in the directory tree.  The /BEFORE template is used before enumerating the files in a directory (before the /CALL template is invoked).  Similarly, the /AFTER template is used AFTER the files have been enumerated and all /CALLs have been done.
  177.  
  178. There are a number of special macros that may be embedded in a template.  These macros are:
  179.  
  180. @Description{
  181. $$@/The dollar-sign character
  182.  
  183. $s@/The source filename (made with first pathname)
  184.  
  185. $d@/The second filename (made with second pathname)
  186.  
  187. $c@/The current working directory
  188.  
  189. $f@/Just the filename portion of the file (no directory path)
  190.  
  191. $b@/The size of the source filename
  192.  
  193. $g@/The greater-than sign character (>)
  194.  
  195. $l@/The less-than sign character (<)
  196.  
  197. $p@/The pipe character (|)
  198.  
  199. $q@/The double-quote character (")
  200. }
  201.  
  202. For example, to type all the C programs on the hard disk, the following NTREE command could be used:
  203.  
  204. NTREE C:\ /CALL "type $s"
  205.  
  206. To make a file with DOS "DIR" listings for an entire disk, you could use:
  207.  
  208. NTREE C:\ /BEFORE "dir $s $g$gC:\master.dir"
  209.  
  210. You could compare two disks, file by file, with:
  211.  
  212. NTREE A:\ B:\ /CALL "fc $s $d"
  213.  
  214. There are a few switches that work with this command:
  215.  
  216. @Description{
  217. /H@/Do hidden files too.
  218.  
  219. /BAT@/Do not execute DOS commands, simply write them to stdout.  If you redirect NTREE's output to a file, you can generate batch files this way.
  220.  
  221. /V@/Turn DOS Verify flag ON
  222. }
  223.  
  224. Since the DOS commands are executed via system(), it is a good idea to keep a copy of COMMAND.COM on your RAM disk.  Because system() is used, batch files may be also executed in a command.
  225.  
  226.