Advertisement
Guest User

Spostare File Python

a guest
Jan 20th, 2014
653
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import shutil
  2. import os
  3. import random
  4. import time
  5.  
  6. def move(path,dest,temp):
  7.     x=os.listdir(path)
  8.     numerofile=len(x)
  9.  
  10.     while(numerofile>-1):
  11.  
  12.         numerofile=numerofile-1        
  13.  
  14.         m=random.randint(0, numerofile)
  15.  
  16.         print(m)
  17.  
  18.         s=path+"/"+x[m]
  19.    
  20.         shutil.move(s,dest)      
  21.          
  22.         del x[m]
  23.        
  24.         time.sleep(temp)
  25.         if numerofile==0:
  26.            
  27.             return "Programma Terminato"
  28.  
  29.  
  30.  
  31. dest= "C:/Users/Dropbox/Cartella"
  32. path= "C:/Users/Desktop/rinominati"
  33. temp= 1800
  34.  
  35. print move(path,dest,temp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement