Why script programming is particularly suited for problem

Assignment Help Programming Languages
Reference no: EM132249849

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: EM132249849

Questions Cloud

How many immigrants should canada be accepting : Your response will be in answer to this question: How many immigrants should Canada be accepting; more, the same or fewer?
Difference between contractionary and expansionary fiscal : Government budget and fiscal policy works through the shift of aggregate demand and is most often used to tackle unemployment issues.
Explain what are the main issues being discussed : MGT323- Project Management, Summarize the article. Explain, what are the main issues being discussed?
Types of advertisement to seduce the public : In today’s society, businesses attempt with the help of the media, Internet, direct marketing and other types of advertisement to seduce the public
Why script programming is particularly suited for problem : Write a Perl script to automate task - Your script will be tested against several other directories, using different combinations of parameters
Suppose the supply of fruits goes down : Suppose the supply of fruits goes down. Does this mean that the supply of a complementary good goes down too?
Prepare an assessment of social service agencies : For this assignment, prepare an assessment of social service agencies that address the current social problem/issue you developed in Week 1 and Week 6.
What steps craig took to develop and grow his business : Discuss what steps Craig took to develop and grow his business. Illustrate the role Craig played in contributing towards the economy.
What makes you confident that the rfp is worth pursuing : What makes you confident that this RFP is worth pursuing? What are the selected funding agency's goals and applicant eligibility?

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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