The task is to recurse through a subtree of the filesystem and put a file called dir.xml in each directory. You will pull data from 2 sources: the directory itself, and a file that may appear in each directory calledREADME .
. Here is what the directory looks like:
CS: index.html Files/ Labs/ README labs.html 1/ README file1.1 file1.2 file1.3 index.html other4 other5 2/ Data/ README a b c README file2.1 file2.2 index.html other1 other4 other5 3/ README file3.1 file3.2 file3.3 file3.4 index.html other4 Lectures/ README lecs.html
The README file may have 2 entries, each on its own line. Fields are separated by colons. Neither entry is required:
index - lists (maybe) a single file, the top-level HTML page for this directory.
required - a list of files that should be in this directory
You will write a script (or, scripts) that will take an optional argument, the directory to process. If not argument is supplied, use the current directory.
In each subdirectory (including the top-level directory on which the script was called) you will place a file called dir.xml . If it already exists, simply overwrite it. Donot include it as one of the files listed.
The root element will be direntry. It may contain up to 3 child nodes: index, required, and other. These three elements will contain text elements, either of type fileor dir.
Index and required data will be harvested from README (use AWK to parse this file). Other files will be found by taking a listing of the directory, looking for files or directories that weren't listed in README.
For example, the following file would be placed in CS265/Labs/2 :
?xml version="1.0" encoding="ISO-8859-1"?>
<direntry> <index> <file>index.html</file> </index> <required> <file>file2.1</file> <file>file2.2</file> </required> <other> <dir>Data</dir> <file>other1</file> <file>other4</file> <file>other5</file> <file>README</file> </other> </direntry>
Recently Asked Questions
- a company STY Limited exports goods to Korea, but in the transit tight checks by australian custom officials have delayed several shipments. the delays have
- BU490 7.In a monopoly, how many sellers are there? a.There a relatively small number of large firms controlling the market. b.There is only one seller, but
- Please refer to the attachment to answer this question. This question was created from AMSCO-Ch.-1-Guided-Reading (1).docx.