Skip to content

Instantly share code, notes, and snippets.

@mrx6s0
Created August 9, 2017 19:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrx6s0/3ed0fc3e50641625065524148b721992 to your computer and use it in GitHub Desktop.
Save mrx6s0/3ed0fc3e50641625065524148b721992 to your computer and use it in GitHub Desktop.
#!/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
@mrx6s0
Copy link
Author

mrx6s0 commented Aug 9, 2017

good way!

@mrx6s0
Copy link
Author

mrx6s0 commented Aug 9, 2017

dump everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment