Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Acest script cauta fisiere .mp3 si le muta in folderul muzica
- import os
- import time
- import sys
- import shutil
- def principal ():
- print("--------S T A R T--------")
- alege = input ("Ce doresti sa sortezi? (imagini/muzica) ")
- if alege == muzica:
- muzica ()
- elif alege == imagini:
- imagini ()
- path = "/sdcard/Download"
- list = os.listdir(path)
- count = 0
- def imagini():
- try:
- file = os.mkdir('/sdcard/Download/imagini')
- except OSError:
- print ("fișierul exista")
- for file in list:
- extensie = file.endswith (".png")
- extensie2 = file.endswith(".jpg")
- extensie3 = file.endswith (".gif")
- if extensie == True or extensie2 == True or extensie3 == True:
- shutil.move ('/sdcard/Download/' + file, '/sdcard/Download/imagini')
- print("DONE")
- def muzica ():
- #Aceasta functie sorteaza muzica
- try:
- filemusic = os.mkdir ('/sdcard/Download/muzica')
- except OSError:
- print ("Fisierul muzica exista deja")
- for file in list:
- extensie = file.endswith('.mp3')
- if extensie == True:
- shutil.move ("/sdcard/Download/" + file, "/sdcard/Download/muzica")
- count +=1
- print("Toate fisierele mp3 au fost mutate in folderul muzica")
- print("Au fost transferate", count, "fisiere")
- print ("DONE")
- if __name__ == '__main__':
- principal()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement