Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from os import *
- userpath = sys.argv[1]
- def validates_path(fpath): #valida o caminho até o diretório
- if (path.exists(fpath) == False) or (path.isdir(fpath) == False):
- fpath = str(input("Error! Insert a valid path: "))
- validates_path(fpath)
- return True
- validates_path(userpath)
- command0 ='cd ' + userpath
- system(command0)
- archives = listdir(userpath)
- confirmation = input("You entered the path:\n" + userpath + ".\nAre you sure you want to proceed (y/N)?: ")
- if confirmation in ['y', 'Y']:
- for archive in archives:
- archive_path = userpath + '/' + archive
- new_archive_path = userpath + '/file_' + archive
- system('mv ' + archive_path + ' ' + new_archive_path)
- else:
- print("End process.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement