Write a python script that will implement the given command

Assignment Help Python Programming
Reference no: EM131258442

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.

Submit your source code. Submit the results of your program by showing detailed directory listings (including file times) of two source directories and a newly created destination directory.

Reference no: EM131258442

Questions Cloud

Why would more be needed or some access points blocked off : Explain the role special interest groups play in their effort to influence legislation that dictates reentry and rehabilitation policy. Then from a macro perspective, should there be so many access points that allow special interest groups to acc..
Draw the precedence diagram : Draw the precedence diagram. - Assign tasks to the minimum feasible number of workstations according to the "ranked positioned weight" decision rule.
Analyze all costs and benefits of moving to virtual desktop : Analyze all the costs and benefits of moving to a virtual desktop solution, and propose a minimum of four benefits of the new system over the existing one.
Determine the maximum shear stress tmax : The figure shows two thin-walled box sections with overall dimensions given in terms of a.
Write a python script that will implement the given command : Write a python script that will implement the following command: The idea is that the contents of sourcedirectory1 and sourcedirectory2 are going to be copied and merged together into a new destination directory.
Initial equilibria in the money market : Label your initial equilibria in the money market (before the Olympics started) with an A and in the forex market with an A'.
What is the efficiency of the assembly line : Draw the precedence diagram and assign tasks using five workstations. - What is the efficiency of the assembly line, using your answer to (a)?
Scarcity of resources apply to economic decisions : What are economic resources, and how does scarcity of resources apply to economic decisions? Think of a business firm you recently visited (such as Walmart, Home Depot, Red Lobster, Barnes & Noble, McDonald's, etc.).
What aspects of this action may shock the conscience : Identify the issues your partner has that relate to the exclusionary rule. What aspects of this action may shock the conscience of the court? What ensuing evidence found based on this operation may be discarded as "Fruit of the Poisonous Tree".

Reviews

Write a Review

Python Programming Questions & Answers

  1 one factor that leads to a decline in biodiversity is the

1. one factor that leads to a decline in biodiversity is the introduction of non-native species. however most species

  Find a python script

Find a python script

  Create a cheat commands in the game

Create a cheat commands in the game so player can pick up any item he wants from any location in the map - Display all possible actions you can carry out in game.

  Ida to reverse engineer a piece of shellcode

You are a Malware Investigator at 0xC0ff33, Inc and an incident responder came across injected shellcode during an investigation. He has done all he can in IDA and has passed on the .idb file to you. Figure out what the purpose of the malware was ..

  Determines number of occurrences of a given letter in string

In this last checkpoint, you will write a new program that determines the number of occurrences of a given letter in a string. To do so, you are only allowed to use the replace() and len() functions.

  Design and implement a python program which plays poker

The goal of this project is to gain practice with use of classes and creating functions. You will design and implement a Python program which plays simplified Texas Hold'em Poker.

  Write a python program that reads a dumbbasic program

You should write a Python program that reads a DUMBBASIC program from standard input1, and prints the results of executing that program to standard output.

  Two-dimensional word puzzle

Write a python function called find_words that finds and prints the list of valid words in a two-dimensional word puzzle

  What prompted the authors to try and address

What is the question that this study is trying to answer and what prompted the authors to try and address this question?

  Creation of a program that will assemble dna chains

The aim of this assignment is the creation of a program that will assemble DNA chains, using the fragments given

  In this assignment you will write a program that does

in this assignment you will write a program that does simple packet routing. your program will take three command-line

  Write program that read a text file and prints only odd line

Write a program that reads a text file and prints out only odd lines to the screen. Thus, lines 1, 3, 5,... only printed. Update your odd lines program (Q1) to write odd lines to the screen and write then lines to another file.

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