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 recursive boolean method search array for value

Write down the recursive boolean method named isMember. Method must search the array for specified value, and retun true if value is found, or false if value is not foundin array.

  Develop a simple program for inventory system

You have to develop a simple program for an inventory system. You can choose any type of business (ie: Medical supplies, bakery, grocery shop, florist etc.)

  Write a program to compute diameter in centimeters of a rod

Write a program to compute the diameter in centimeters of a steel rod, an aluminum rod, and copper rod, which can withstand a particular compression load.

  How to assign new value to element of array indexed by j

Write single statement which assigns a new value to element of array indexed by j . This new value must be equal to twice the value stored in next element of the array (i.e. element after the element indexed by j.

  Create program that uses array of shape

Create a program that uses an array of Shape references to objects of each concrete class in the hierarchy. The program should print a text description of the object to which each array elements

  Write an application that stores 100 movies

Write an application that stores 100 movies and displays them by category.  The user can enter any of the categories to display the films in the list that match the category.

  Manage listing of missionaries on staff at the organization

In this assignment, you are to design an application, which will manage a listing of missionaries on staff at the Organization Go and Tell.

  Create the application class using appropriate application

Test the class by placing the hard coded data into the driver class, which then instantiates your class and calls its instance method. Pass the hard coded data into the constructor and/or method.

  Program that will first ask the number of overs each team

The program will also display the winning team and the result. That is, if Team A wins then it will display the result in terms of runs. For example, Team A wins by 54 runs, which is the difference between the total runs scored by the teams. Howev..

  Recognize all the potential security threats on a personal

computer security is not an issue for organizations alone. anyone whose personal computer is connected to a network or

  Write a recursive method writeblock

Write a recursive method writeBlock (char, int, int) that uses the recursive method writeLine (char, int) to write m lines of n characters each. For example, writeBlock (‘ *' , 5, 6) produces the following output:

  Write a program in q basic that accept student name

Write a program in Q basic that accept a student name,score obtained in 5 course and compute the average score of the student and my program must display the name of the student

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