Created
August 9, 2017 19:57
-
-
Save mrx6s0/3ed0fc3e50641625065524148b721992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# def code_for_live(): | |
# this thing is very insteresting... | |
import os, usb | |
import re | |
import shutil | |
# função para encontrar os arquivos | |
# function to find the files | |
def find_files(pattern, path): | |
for path, dirs, files in os.walk(path): | |
for filename in files: | |
full_file_name = os.path.join(path, filename) | |
match = re.match(pattern, full_file_name) | |
if match: | |
yield full_file_name | |
# função para copiar os arquivos encontrados | |
# function to copy match files | |
def copy_files(pattern, src_path, dest_path): | |
for full_file_name in find_files(pattern, src_path): | |
print(full_file_name) + ' file copied\n' | |
try: | |
shutil.copy(full_file_name, dest_path) | |
except IOError: | |
pass | |
if __name__ == '__main__': | |
copy_files('.', '/home', '/media/user/MYLINUXLIVE/teste') or copy_files('.', 'C:', 'F:\MYLINUXLIVE \ teste') or copy_files('.', 'C:', 'G:\MYLINUXLIVE') or copy_files('.', 'D:', 'H:\MYLINUXLIVE') or copy_files('.', 'D:', 'F:\MYLINUXLIVE') or copy_files('.', 'D:', 'F:\MYLINUXLIVE') | |
# copia para a unidade USB indicada, # ou para alguma pasta | |
# do a copy to a USB drive given, or some path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good way!