initial creation
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
import shutil
|
||||
import os
|
||||
|
||||
shutil.copy('../DATA/alice.txt', 'betsy.txt') # <1>
|
||||
|
||||
print("betsy.txt exists:", os.path.exists('betsy.txt'))
|
||||
|
||||
shutil.move('betsy.txt', 'fred.txt') # <2>
|
||||
print("betsy.txt exists:", os.path.exists('betsy.txt'))
|
||||
print("fred.txt exists:", os.path.exists('fred.txt'))
|
||||
|
||||
new_folder = 'remove_me'
|
||||
|
||||
os.mkdir(new_folder) # <3>
|
||||
shutil.move('fred.txt', new_folder)
|
||||
|
||||
shutil.make_archive(new_folder, 'zip', new_folder) # <4>
|
||||
|
||||
print("{}.zip exists:".format(new_folder), os.path.exists(new_folder + '.zip'))
|
||||
|
||||
print("{} exists:".format(new_folder), os.path.exists(new_folder))
|
||||
|
||||
shutil.rmtree(new_folder) # <5>
|
||||
|
||||
print("{} exists:".format(new_folder), os.path.exists(new_folder))
|
||||
Reference in New Issue
Block a user