Create a python script that will implement the given command

Assignment Help Python Programming
Reference no: EM131321979

PYTHON

Directory Merger

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 destinationdirectory. 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: EM131321979

Questions Cloud

Describe the scenario where none of philosophers ever eats : Describe the scenario where none of philosophers ever eats (i.e., starvation). What is the sequence of events that happen that lead up to this problem?
Discuss about the social stratification : Social stratification is the ranking of individuals in a hierarchy of unequal wealth, occupational prestige, and power. It is a feature of society and not a reflection of individual uniqueness or differences. Stratification is a universal feature ..
What is the total pressure in kpa : 1. what is the pressure in kPa due to the submersion in the water? (the correct answer is between 1 and 100) 2. What is the total pressure in kPa? (the correct answer is between 100 and 200)
Describe the progress of the research manuscript : Describe the progress of the research manuscript as it is considered for publication in a scientific journal. What are the strengths and weaknesses of the peer review process?
Create a python script that will implement the given command : Write a python script that will implement the following command: merge sourcedirectory1 sourcedirectory2 destinationdirectory. The merger is a union operation, so that if a file/directory exists in either source directory it is included in the new d..
Perfectly elastic collision : A 28 g ball is fired horizontally with initial speed vi toward a 110 g ball that is hanging motionless from a 1.1 m -long string. The balls undergo a head-on, perfectly elastic collision, after which the 110 g ball swings out to a maximum angle θm..
How we internalize our role in our society : We are socialized at every stage in life to conform to our gender identity. Societal reinforcement of tendencies of gender identity is relentless. For example, in hospitals, little girls are wrapped in pink and little boys in blue. This difference..
How are levels of headings of a research report deteermined : What information is contained in each of the supplementary sections of the research report?- How are the levels of the headings of a research report determined?
What is the thermal energy of the gas : a.) A gas bottle contains 7.52×1023 Hydrogen molecules at a temperature of 369 K. What is the thermal energy of the gas? (You might need to know Boltzmann's constant: kB = 1.38×10-23 J/K.)

Reviews

Write a Review

Python Programming Questions & Answers

  Project - expand the simulation with a class hierarchy

Project: Expand the Simulation with a Class Hierarchy. Purpose: Expand classes into a hierarchy. Introduce a View to the Model-View-Controller design pattern. Provide more functionality to the simulation

  Create a luminance (grey) histogram for a picture

In this activity, you will create a \"luminance (grey) histogram\" for a picture # chosen by the user - A luminance histogram is created by counting how many # pixels are there for each level of luminance and then by drawing a chart

  Write an expression whose value is the concatenation

Write an expression whose value is the concatenation of the three str values associated with name1, name2, and name3, separated by commas. So if name1, name2, and name3, were (respectively) "Neville", "Dean", and "Seamus", your expression's value wou..

  Write a python program

Write a Python program

  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.

  Code a console-based program in python

CP1404/CP5632 2016 SP2/22/52 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 selection, repetition,..

  Write a python program that will accept the base and height

Write a Python program that will accept the base and height of a triangle and compute the area. Write a Python program to compute the greatest common divisor (GCD) of two positive integers.

  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..

  The interest rate per period

The interest rate per period. For example, if your loan's interest is 6.5% per year, and you are paying monthly, this would be 6.5%/12. If you are paying every two weeks, r would be 6.5%/26, because there are 26 two-week periods in a year.

  Create a ride share simulator assignment

Create a ride share simulator assignment. In this particular function, I am trying to create a list of the drivers in a Driver Class that are currently listed as idle. Since they are idle, I can then match them up with an awaiting rider. The assignme..

  Design and implement an english test

CSP1150 - Programming Principles - You are required to design and implement an "English Test" program in which the user is presented with a word and then asked to answer a simple question about the word. After 5 words, the program shows the user's..

  You are tasked with improving the code for the haunted

you are tasked with improving the code for the haunted house game. please read the associated hand-out and the code

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