Develop python script that will implement the given command

Assignment Help Python Programming
Reference no: EM131324427

Write a python script that will implement the following command:

merge sourcedirectory1 sourcedirectory2 destinationdirectory

The idea is that the contents of sourcedirectory1 and sourcedirectory2 are going to be copied and merged together into a new destination directory. The destination directory should be created using mkdir() to hold the copied data. The original contents of the two source directories will not be altered. Your script should first parse the command's arguments to see if there are any errors such as invalid names, missing or extra directory names, file names rather than directory names, two names that are the same, or a destination directory that already exists.

The merger is a union operation, so that if a file/directory exists in either source directory it is included in the new directory. Whenever a file exists in both source directories, the newer version of the file should be copied. You can use the os.path.getmtime() function to see when a file was last modified. If two items that have the same name are not both a file or both a directory, then an error message should be displayed saying that you are skipping this pair of incompatible objects. If the two items with the same name are both directories, then you should call your merging routine recursively to process these subdirectories. If one or both of the items is a symbolic link, you should look at the properties of the item being linked to rather than the link itself. You should also end up copying the linked item rather than the link itself.

You should not use the copytree() function in the shutil library in this program. You should write your own recursive function to copy a directory and its contents if needed. When copying a file, use the copy2() function in the shutil library, rather than the copy() function we discussed. This version will preserve as much meta information about the file as possible, such as permissions and times. Make sure that you create new functions appropriately now that you know how.

Reference no: EM131324427

Questions Cloud

What type of employees are considered a protected class : What type of employees are considered a protected class?Compare and contrast the Affirmative Action law briefly discussed in Chapter 12 on page 276, against two of the U.S. laws aimed to prevent employment discrimination described in Figure 13.1, ..
Manuel of clinical microbiology : Due to the prospect of interplanetary travel, how would you attempt to Isolate and identify a bacterial infection acquired on another planet. This bacteria is unknown to use and does not appear in Bergey's or the Manuel of Clinical Microbiology?
Problem regarding the transgenic organisms : The development of transgenic organisms is an established technique in many laboratories. A transgenic organism is an organism that includes DNA from another organism in the cells of its body. This DNA is not only present, but it is also read by t..
Prepare the journal entry to record bad debt expense : Prepare the journal entry to record bad debt expense assuming Vaughn Company estimates bad debts at (a) 4% of accounts receivable and (b) 4% of accounts receivable but Allowance for Doubtful Accounts had a $1,470 debit balance.
Develop python script that will implement the given command : Write a python script that will implement the following command: merge sourcedirectory1 sourcedirectory2 destinationdirectory
Identify the appropriate arbitrage opportunity : Suppose that the current stock price is $90- Identify the appropriate arbitrage opportunity and show the appropriate arbitrage strategy.
Will the new level of operating leverage : At an output level of 83,000 units, you calculate that the degree of operating leverage is 3. The output rises to 90,000 units. What will the percentage change in operating cash flow be? Will the new level of operating leverage be higher or lower?
Describe the protocols and foundations of the internet : Analyze the functional problems of throughput, delay, and packet loss as it pertains to your plan. Analyze and explain how you would use.DNS in your plan. Compose a two-paragraph executive summary highlighting the main points of your plan. Use at l..
How their true cost of living changes over time : Under what circumstances would people find this index to be as useful as or more useful than the Consumer Price Index in measuring how their true cost of living changes over time?

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python function to check whether a number is perfect

Write a Python function to check whether a number is perfect or not. According to Wikipedia : In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors.

  How a vertical scroll bar is associated with a list box

What are instance variables, and what role does the name ‘self' play in the context of a class definition. Describe how a vertical scroll bar is associated with a list box.

  Write a python program that performs simple encryption

You are required to write a Python program that performs simple encryption and decryption on strings entered by the user. To do so, you are to use one of the simplest and most widely known encryption techniques known as the Caesar Cipher

  Write an expression that concatenates the string

Write an expression that concatenates the String variable suffix onto the end of the String variable prefix .

  Modify your code to ask the user for the id of a restaurant

Copy check1.py to check2.py and continue to work on check2.py. Modify your code to ask the user for the id of a restaurant between 1 and 155 (humans don't need to know about list ids starting at 0).

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Part-1for task 1 list the things you changed and the

part-1for task 1 list the things you changed and the purpose of changing it. good reasons include making code easier

  Code a console-based program in python

CP1404/CP5632 2016 SP2/22/52 Assignment 1 - Shopping List 1.0. You are to plan and then code a console-based program in Python 3, as described in the following information and sample output. This assignment will help you build skills using selectio..

  Write a program that acts like a simple calculator

You will write a program that acts like a simple calculator for binary numbers. You should read in a string of input that has the format: number operator number.

  Improve the code for the haunted house game

Improve the readability of the code by improving the function names, variables, and loops, as well as whitespace. Document these changes in your journal and define a win condition for the game, for example, collecting all items and returning to the..

  How to step through and process the elements of a list

Programming in Python CS21A- Learn how to find high and low values of a list. Learn how to step through and process the elements of a list. Learn how to pass lists as arguments to a function. Learn how to wr..

  What is complexity in asymptotic notation of your solution

Write a program in Python to draw the following figure: What is the complexity in asymptotic notation of your solution? Return the "centered" average of an array of ints, which we'll say is the mean average of the values.

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