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

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  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.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

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