Describe two possible extensions of your script

Assignment Help Programming Languages
Reference no: EM132249864

Assignment

Task 1: Script programming

Consider the following situation:

You are given a directory from a webserver that contains multiple HTML files as well as multiple files of other types (e.g. images). The directory may contain subdirectories. You are asked to clean up this directory and its subdirectories by removing all unused files. A file is considered unused if it is not linked in any of the HTML files or if it is not specified explicitly that this file is in use. A file can be linked in a HTML file by either a href or img src. It does not matter whether the link is within a commented-out section of the HTML file. Do not remove subdirectories.

The files you remove must be stored in a user-specified directory. You need to maintain the directory structure when storing the removed files (e.g. if you remove two files a/b/a.txt and a/a.txt, both files must be stored under their directories).

You also need to create statistics output for the files that have been removed. The statistics output must be in text form and must contain, for each file ending, the number of files and the overall size of files with that ending. In addition, the number and size of all removed files needs to be reported. For this purpose, file- endings are not case-sensitive (i.e. .gif and .GIF are considered the same for statistics purposes). The statistics must also contain the name of the directory on which the cleanup script has been run.

T1.1: Write a Perl script to automate this task. The script must be run as follows: cleanup.pl [CleanupDir] [RubbishBinDir] [ListOfUsedFiles] where
[CleanupDir ] is the name of the directory to clean up.
[RubbishBinDir ] is the name of the directory where removed files are to be stored.
[ListOfUsedFiles ] is a list of 0 or more files that are in use and should not be deleted.

Your script must handle errors such as missing parameters, missing files, missing di- rectories, missing access permissions, or input/output errors gracefully, that is, it must not crash on encountering them. Depending on what is appropriate, your script may handle errors by displaying a warning and continuing, by displaying an error message and aborting, or by taking other actions (e.g. creating a missing directory). Your script should try to fix problems, if this is possible.

T1.2: Discuss, in at most 300 words, why script programming is particularly suited for problem, and describe two possible extensions of your script and how they could be achieved.

Assessment criteria for Task 1.1

1. The script will be run against the directory www/ in the provided archive example.zip. The script will be run in the directory example/ as follows:
rm -Rf report.txt rubbish-bin/
cleanup.pl www/ rubbish-bin/ index.html > report.txt
After the script has run, the contents of the directory www/ should be exactly like the contents of the directory www-after/, the directory rubbish-bin/ should exist and have the same contents the directory has now, and the file report.txt must exist and contain the same text as it contains now.

2. Your script will be tested against several other directories, using different combinations of parameters that are allowed according to the description.

3. Your script will be manually inspected for code quality.

Attachment:- assignment questions.zip

Reference no: EM132249864

Questions Cloud

Discounting and consumption costs : Assume the value of a QALY is $100,000, and ignore discounting and consumption costs.
What kind of hypothesis would you test : As scientists conducting an experiment, you need to have an experimental group and a control group for testing a hypothesis. If you were a scientist.
South korea differ from that in thailand : According to Mushtaq H. Khan, how does the process of rent-seeking in South Korea differ from that in Thailand?
Discussion about the strategic management : Strategy formulation starts with developing a vision and mission statement, creating a SWOT analysis, deciding on long-term objectives.
Describe two possible extensions of your script : Discuss, in at most 300 words, why script programming is particularly suited for problem, and describe two possible extensions of your script
Businesses looking to sell abroad : How does the lower demand for U.S. dollars affect the value of the U.S. dollar, and consequently, is this good or bad for U.S. businesses looking to sell abroad
Required reserve ratio imposed : 1. Consider the following accounts of the First National Bank.
Find an interesting report of a scientific discovery : Find an interesting report of a scientific discovery that was in the news within the last five years. Your initial source can be a newspaper, journal.
Explain the behavior of the federal reserve : Explain the behavior of the Federal Reserve considering a balance of payments disequilibria within a fixed exchange rate system.

Reviews

Write a Review

Programming Languages Questions & Answers

  Module program to compare state and county sales tax

Create a module program which will ask the user to enter amount of a purchase. Program must then compare state and county sales tax.

  Write sql commands

Consider the following tables FACULTY and COURSES. Write SQL commands for the

  Explain how is recursion and iteration used in programming

question 1 how is recursion and iteration used in programming? provide examples of the various types of recursion and

  Rewrite returns expression in which cond has been replaced

Write the function rewrite (x), x is an s-expr. If x is not a "legal" cond, rewrite returns nil. Otherwise, rewrite returns an expression in which each cond has been replaced by an equivalent sequence of nested if- then.

  Writing code in client program to enter score

Write down code in a client program to perform the following: prompt user to enter score and set score data member for player1.

  Create a single form home utility audit program

Create a single form Home Utility Audit Program using Visual Studio Desktop 2013, VB.Net. I have most of it except the * parts in specific requirements

  Do comments explain processing that is not obvious

When reviewing a program, these are the four criteria for style: Do identifiers logically describe use? Is indentation used correctly to illustrate the structure of the program?

  Write a program to generate a patient bill

Write programs in Visual Basic while being guided by the six steps of the program development cycle: analyze the problem, design a solution, choose the interface, write code, test and debug your solution, and document code.

  Create a form application

Create a form that has a text area that will hold Mission Title and Adjusted Total Box Office Profit data.

  Implement and test the functions

Programming Assignment - implement and test the four functions described below that use pointers and dynamic memory allocation and Rewrite the function so it uses pointers instead of reference parameters. When you test this function from the main pr..

  Write an automated checkout program

A local department store hires you to write an automated checkout program designed specifically for their express checkout lane.

  Write a script named lab6s2 that writes the current time

Write a script named lab6s2 that writes the current time and date, lists logged-in users, and prints the system's uptime to a log file. The time should be printed with the format of "03:55 am" as opposed to military time.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd