Question

Close the terminal, and open a new terminal session. Create a new directory ~/backups Accomplish the...

  1. Close the terminal, and open a new terminal session.
  2. Create a new directory ~/backups
  3. Accomplish the following steps by typing on the command line within a period of a couple minutes so the timestamps will be similar:
  • Navigate to ~/backups
  • ls ~/Documents
  • Run your doc-backup script.
  • tar -tf <your tar file> to see the contents. (If this produces a large amount of output, be sure you cut it down to a few lines in the terminal capture later.)
  • Run doc-backup a second time.
  • cat ~/scripts/doc-backup to show your script code
  • Execute the date +%y%m%d-%s command to get a timestamp on the command line.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python Code :

import os
import tarfile
path = '../Documents'
fileName = 'backup1.tar.gz'
with tarfile.open(fileName, "w:gz") as h:
   for root, dirs, files in os.walk(path):
       for file in files:
           h.add(os.path.join(root, file))

Add a comment
Know the answer?
Add Answer to:
Close the terminal, and open a new terminal session. Create a new directory ~/backups Accomplish the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • QUESTION 1 From YOUR home directory, execute a find command string that will locate the file...

    QUESTION 1 From YOUR home directory, execute a find command string that will locate the file called resolv.conf. Include the -exec flag in the find command to cat the file to the screen. Begin your find search from the letc directory Select the correct find command string below that will accomplish this. find /etc-name 'resolv.conf -cat D find /etc-name 'resolv.conf -exec cat 0 find. -name 'resolv.conf -exec cat 0\ find /-name 'resolv.conf' -exec cat 0 QUESTION 2 What find command...

  • This is done in Linux terminal. Modify the .bashrc file using command line which would add...

    This is done in Linux terminal. Modify the .bashrc file using command line which would add the following functionality to your shell upon opening a new terminal: 1. Alias called “fc” (short for “folder contents) invoking the command “ls -lah”B. Welcome message “This is demo number 7” C. Variable “semester” being equal to “Winter 2020” and print the value on screen 2. Create any directory of your choice and add it to PATH variable. 3. Show an example of local...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT