home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 423_01 / rdcf / files.doc < prev    next >
Encoding:
Text File  |  1993-01-14  |  14.2 KB  |  421 lines

  1.        FILES - A Small File and Directory Manipulation Utility for DOS
  2.  
  3.                             by Philip J. Erdelsky
  4.                           PLAIN VANILLA CORPORATION
  5.                             CompuServe 75746,3411
  6.                       InterNet 75746.3411@compuserve.com
  7.  
  8.                                January 15, 1993
  9.  
  10.                    PUBLIC DOMAIN -- NO RESTRICTIONS ON USE
  11.  
  12. 1. Introduction
  13. ---------------
  14.  
  15. The FILES utility is a small file and directory manipulation utility for DOS
  16. (versions 2.00 and later).  It was written mainly to test RDCF 2.0 and
  17. duplicates a number of DOS internal and external commands, but it adds enough
  18. functions to DOS to be useful in itself.
  19.  
  20. Here is what you can do with the FILES utility that you cannot do with DOS
  21. commands alone:
  22.  
  23.      (1) You can see hidden, system and deleted files and volume labels in
  24.          directory listings. (You can see hidden and system files, but not
  25.          deleted files, with DOS 5.0.)
  26.  
  27.      (2) You can change the date and time of a file, directory or volume
  28.          label.
  29.  
  30.      (3) You can sort a directory.
  31.  
  32.      (4) You can restore a deleted file, if the file is not fragmented and has
  33.          not been overwritten.
  34.  
  35.      (5) You can move a file or subdirectory from one directory to another
  36.          without copying its data.
  37.  
  38.      (6) You can recover remnants of deleted files in the empty data clusters.
  39.  
  40.      (7) You can wipe out remnants of deleted files in empty data clusters so
  41.          they cannot be recovered later.
  42.  
  43. Some of these things can't be done even by special programs that issue DOS
  44. calls.  The FILES utility can do them only because it goes around the DOS file
  45. system and accesses the disk on a sector-by-sector basis.
  46.  
  47. The FILES utility works with diskettes and hard disk partitions smaller than
  48. 32 megabytes.  It will not work with larger partitions, such as those used by
  49. DOS 4.00 and later versions of DOS, and it will not work with LAN drives.
  50.  
  51. IMPORTANT: The FILES utility does not recognize any current drive or
  52. subdirectory.  You will have to type an explicit drive specification for every
  53. file, and, for a file not in the root directory, a complete directory path.
  54. Contrary to the usual DOS practice, the directory path must NOT begin with a
  55. backslash.  Sorry about that.
  56.  
  57. The FILES utility and its source code are in the public domain, but the RDCF
  58. 2.0 file package is copyrighted.  If you want to make changes to the FILES
  59. utility for your own use, you will have to obtain RDCF 2.0.  You may make
  60. copies for your own use, but commercial use of RDCF 2.0 requires permission.
  61. You will also need a third package called the Reentrant Cache System 1.1, but
  62. that is also in the public domain.
  63.  
  64. The current version of the FILES utility treats drives other than A: and B: as
  65. read-only.  You can change that if you know what you're doing.
  66.  
  67.  
  68. 2. Bringing up the FILES Utility
  69. --------------------------------
  70.  
  71. The FILES utility resides in the file FILES.EXE.  Copy this file from the
  72. distribution diskette, or download it from a BBS.
  73.  
  74. Make sure the file FILES.EXE is in the current directory, or in a directory
  75. made accessible by the DOS PATH command, and type
  76.  
  77.      FILES
  78.  
  79. in response to the DOS prompt.
  80.  
  81. The FILES utility will then display its prompt:
  82.  
  83.      FILES>
  84.  
  85. Enter FILES commands just as you would enter DOS commands, using the backspace
  86. key to make corrections.  If you have installed a DOS command line editor, it
  87. will probably work with the FILES utility because the utility uses the same
  88. DOS system call (number 10) as the DOS command line interpreter.
  89.  
  90. It is presumed that you are reasonably conversant with DOS commands. 
  91.  
  92. You can execute FILES commands from a file by simply redirecting the file to
  93. the FILES utility as its standard input; e.g.,
  94.  
  95.      FILES  <file
  96.  
  97. Be sure to end the file with an EXIT command, or you'll have to reboot to
  98. regain control of your computer!
  99.  
  100. If you use this technique, remember that the command file is being read by DOS,
  101. not by the FILES utility.  Do not include FILES commands that write to the
  102. drive on which the command file resides.  The FILES utility and DOS will not
  103. cooperate.
  104.  
  105. If you can't remember the FILES commands, just type HELP in response to the
  106. FILES> prompt.  Here is what you'll see:
  107.  
  108.      COPY     source  destination
  109.      DATE     file  month-day-year  hour:min:sec
  110.      DEL      file
  111.      DIR      directory
  112.      DIRSORT  directory
  113.      EXIT
  114.      HELP
  115.      MD       directory
  116.      MCOPY    files directory
  117.      MOVE     source  destination
  118.      RECOVER  file
  119.      REN      old  new
  120.      TYPE     file
  121.      UNDEL    file
  122.      VOLUME   name
  123.      WIPE     drive
  124.  
  125.  
  126. 2.1. COPY - Copy a File
  127. -----------------------
  128.  
  129. The FILES command
  130.  
  131.      COPY  source  destination
  132.  
  133. copies one file to another, just the way DOS does.  However, you cannot copy
  134. multiple files, and you must supply complete file specifications.  For
  135. example, to copy the file FOO.C from drive A: to the subdirectory \PROG on
  136. drive B:, you must type
  137.  
  138.      COPY  A:FOO.C  B:PROG\FOO.C
  139.  
  140. For file copying, you'll probably prefer to use DOS.
  141.  
  142.  
  143. 2.2. DATE - Change the Date and Time of a File, Directory or Volume
  144. -------------------------------------------------------------------
  145.  
  146. The FILES command
  147.  
  148.      DATE  file  month-day-year  hour:min:sec
  149.  
  150. changes the date and time of a file or subdirectory.  The date and time are
  151. expressed in numerical form, and a 24-hour clock is used.  To change the date
  152. and time of the file A:FOO.C to September 15, 1992, 3:15 PM, type
  153.  
  154.      DATE  A:FOO.C  9-15-92 15:13:00
  155.  
  156. If the file specifications represent a subdirectory, its date and time will be
  157. changed.  That's something DOS won't do!
  158.  
  159. If you use a drive specification only, the date and time of the volume label
  160. will be changed.
  161.  
  162.  
  163. 2.3 DEL - Delete a File, Directory or Volume
  164. --------------------------------------------
  165.  
  166. The FILES command
  167.  
  168.      DEL  file
  169.  
  170. deletes the specified file.  If the file specifications represent a
  171. subdirectory, it deletes the subdirectory (provided it is empty).  Hence it
  172. does the work of both the DOS DEL and RD commands.
  173.  
  174. If you use a drive specification only, the volume label will be deleted.
  175.  
  176.  
  177. 2.4. DIR - Directory Listing
  178. ----------------------------
  179.  
  180. The FILES command
  181.  
  182.      DIR  directory
  183.  
  184. lists the contents of the specified directory, including volume labels, hidden
  185. and system files, subdirectories and deleted volume labels, files and
  186. subdirectories.
  187.  
  188. If you use a drive specification only, contents of the root directory will be
  189. displayed.
  190.  
  191. To pause the display, type Ctrl-S; to abort the display, type Ctrl-C.
  192.  
  193.  
  194. 2.5. DIRSORT - Sort a Directory
  195. -------------------------------
  196.  
  197. The FILES command
  198.  
  199.      DIRSORT  directory  mode
  200.  
  201. sorts the entries in the specified directory in the specified manner.
  202.  
  203. The mode may be any ONE of the following:
  204.  
  205.      mode  manner of sort
  206.      ----  -----------------------------------------------------------------
  207.      E     sort by extension, then among files that have the same extension,
  208.              sort by name
  209.      D     sort by date and time (earlier files first)
  210.      N     sort by name, then among files that have the same name, sort by
  211.              extension
  212.      S     sort by size (smallest files first)
  213.  
  214. The letter R may be appended to any of these modes to sort in the opposite
  215. order.  For example, SR sorts the files by size, but it puts the largest files
  216. first.
  217.  
  218. If you omit the mode, N is presumed.
  219.  
  220. Actually, before the FILES utility sorts the directory entries, it first
  221. divides them into five groups and arranges them in the following order:
  222.  
  223.      (1) The two system files at the beginning of the root directory and the
  224.          two special files "." and ".." at the beginning of a subdirectory are
  225.          always left where they are.
  226.  
  227.      (2) The volume label, if any, is put next.
  228.  
  229.      (3) The subdirectory entries, if any, are sorted and put next.
  230.  
  231.      (4) The file entries are sorted and put next.
  232.  
  233.      (5) The entries for deleted files, volume labels and subdirectories, if
  234.          any, are sorted and put last.
  235.  
  236. Within each category, if two entries are identical according to the sorting
  237. criterion, their relative position is left unchanged.
  238.  
  239. If you supply only a drive specification, the root directory will be sorted.
  240.  
  241. The sorting algorithm is fairly unsophisticated, so sorting a long
  242. subdirectory may take quite some time.  Please be patient.
  243.  
  244.  
  245. 2.6. EXIT - Return to DOS
  246. -------------------------
  247.  
  248. The following FILES command returns control to DOS:
  249.  
  250.      EXIT
  251.  
  252. If you redirect commands from a file to the FILES utility, be sure to end it
  253. with an EXIT command.  Otherwise, the utility will hang up at the end of the
  254. file and you'll have to reboot to regain control of your computer.
  255.  
  256.  
  257. 2.7. HELP - Display a List of FILES Commands
  258. --------------------------------------------
  259.  
  260. The following FILES command displays a list of FILES commands:
  261.  
  262.      HELP
  263.  
  264.  
  265. 2.8. MD - Make Directory
  266. ------------------------
  267.  
  268. The FILES command
  269.  
  270.      MD  directory
  271.  
  272. creates the specified directory, just like the corresponding DOS command.
  273.  
  274.  
  275. 2.9. MOVE - Move a File or Subdirectory
  276. ---------------------------------------
  277.  
  278. The FILES command
  279.  
  280.      MOVE  source  destination
  281.  
  282. moves the source file to the destination file.  Since it is not possible to
  283. move a file from one drive to another with this command, the destination file
  284. specifications must NOT contain a drive specification.
  285.  
  286. For example, to move the file FOO.C from the root directory to the
  287. subdirectory PROG on drive B:, type
  288.  
  289.      MOVE  B:FOO.C  PROG\FOO.C
  290.  
  291. The effect of this command is the same (in almost all cases) as the following
  292. two commands, but it is much more efficient because the data is not copied:
  293.  
  294.      COPY  source  destination
  295.      DEL   source
  296.  
  297. (Slight differences occur when the disk is nearly full.  The COPY-DEL sequence
  298. may fail for lack of disk space but MOVE will succeed.)
  299.  
  300. You can rename a file as you move it merely by giving it a different name in
  301. the new directory.  You could also use this command to rename a file without
  302. moving it, but it would be less efficient than the REN command and might fail
  303. for lack of directory space when then REN command wouldn't.
  304.  
  305. If the source file specifications represent a subdirectory, it and all of the
  306. files and subdirectories in it will be moved.  That's something that DOS won't
  307. do, and it can be quite handy.  However, be sure not to corrupt the file
  308. system by moving a directory into itself or one of its own subdirectories.
  309. The FILES utility won't protect you from such folly.
  310.  
  311.  
  312. 2.10. RECOVER - Recover Deleted File Remnants in Empty Clusters
  313. ---------------------------------------------------------------
  314.  
  315. The FILES command
  316.  
  317.      RECOVER  file
  318.  
  319. creates the specified file as a new file, gathers all the empty data clusters
  320. on drive and links them together as the new file contents.  The new file will
  321. then contain all the data from deleted files and subdirectories that has not
  322. been reused by other files or subdirectories.
  323.  
  324. If you want to use a text editor or word processor on the new file to find the
  325. desired information, you will probably have to copy the file to another disk or
  326. a hard drive that has room for the temporary and backup files that most text
  327. editors and word processors require.  For obvious reasons, there won't be any
  328. room on the same disk!
  329.  
  330. The new file must not be the same as an existing file.  It may reside in a
  331. subdirectory, but the FILES utility will not lengthen the subdirectory to
  332. accommodate it, since that would destroy some of the information that you want
  333. to recover.
  334.  
  335.  
  336. 2.11. REN - Rename a File
  337. -------------------------
  338.  
  339. The FILES command
  340.  
  341.      REN  old  new
  342.  
  343. renames a file, without moving it to another directory or drive.  The new file
  344. specifications may include a name and extension only.  For example, the
  345. following command changes the file A:PROG\FOO.C into A:PROG\BAH.C:
  346.  
  347.      REN  A:PROG\FOO.C  BAH.C
  348.  
  349.  
  350. 2.12. TYPE - Display a File
  351. ---------------------------
  352.  
  353. The FILES command
  354.  
  355.      TYPE  file
  356.  
  357. displays the contents of a file.
  358.  
  359. To pause the display, type Ctrl-S; to abort the display, type Ctrl-C.
  360.  
  361.  
  362. 2.13. UNDEL - Undelete a File
  363. -----------------------------
  364.  
  365. The FILES command
  366.  
  367.      UNDEL  file
  368.  
  369. attempts to restore a deleted file.  The FILES utility will tell you whether
  370. the file is unrecoverable, partly recoverable or fully recoverable.
  371.  
  372. Even if the file appears to have been fully recovered, there is no guarantee
  373. that the original file contents have been restored.  For example, if another
  374. file has been written over the original contents and then deleted, there is no
  375. way that the FILES utility can determine that the original contents have been
  376. changed.  Even if this has not happened, the FILES utility may not know
  377. exactly where to look for the contents.  It just does the best it can.
  378.  
  379.  
  380. 2.14. VOLUME - Add or Change Volume Label
  381. -----------------------------------------
  382.  
  383. The FILES command
  384.  
  385.      VOLUME  drive:
  386.  
  387. displays the volume label for the specified drive, or tells you that the drive
  388. has no volume label.
  389.  
  390. The FILES command
  391.  
  392.      VOLUME  drive:  label
  393.  
  394. changes the volume label on the specified drive to the specified text, or adds
  395. a new volume label with the specified text.
  396.  
  397. DOS file and directory names and extensions are case-insensitive, but the same
  398. is NOT true of volume labels.  They can contain small letters, spaces and
  399. some special characters.  Command syntax will prevent you from embedding a
  400. space in a volume label, even though DOS might permit it on a disk.
  401.  
  402.  
  403. 2.15. WIPE - Wipe Empty Data Clusters
  404. -------------------------------------
  405.  
  406. The FILES command
  407.  
  408.      WIPE  d:
  409.  
  410. writes nonsense into all unused data clusters on the specified drive, so any
  411. remnants of deleted files on the drive cannot be recovered by either the UNDEL
  412. or the RECOVER command.
  413.  
  414. CAUTION: If the drive uses data clusters consisting of more than one sector,
  415. there may be some remnants of deleted files in the last clusters of files that
  416. are not long enough to occupy all sectors of their last clusters.  These
  417. little snippets of information cannot be recovered by the FILES utility, but
  418. they can be recovered by more sophisticated utilities.
  419.  
  420.  
  421.