Created
February 9, 2020 18:36
-
-
Save keremistan/7f81b8e225411691879d566f5a030514 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
from os import path, getcwd, mkdir, walk | |
from shutil import copy2, copyfile | |
def klasorleri_gez(kynk, hdf): | |
butun_icerik = walk(kynk, False) | |
butun_icerik_liste = [i for i in butun_icerik] | |
for i in range(len(butun_icerik_liste)): | |
klasor = butun_icerik_liste[i] | |
klasor_adresi = klasor[0] | |
klasordeki_dosyalar = klasor[2] | |
for dosya in klasordeki_dosyalar: | |
dosya_adress = path.join(klasor_adresi, dosya) | |
if '.jpg' in dosya_adress or '.png' in dosya_adress or '.jpeg' in dosya_adress: | |
print('Kopyalaniyor: ', dosya_adress) | |
copy2(dosya_adress, hdf) | |
if __name__ == "__main__": | |
HEDEF_KLASOR_ISIM = 'hedef_klasor' | |
KAYNAK_KLASOR_ISIM = "/Volumes/Time{}Machine/Backups.backupdb/Kerem’s{}MacBook{}Pro{}(2)/".format(" ", " ", " ", " ") | |
cwd = getcwd() | |
hedef_klasor = path.join(cwd, HEDEF_KLASOR_ISIM) | |
mkdir(hedef_klasor) | |
klasorleri_gez(KAYNAK_KLASOR_ISIM, HEDEF_KLASOR_ISIM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment