Змея / Говнокод #27206 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
import fnmatch,os,datetime,time,re,shutil,sys 
	
def find(pattern, startdir=os.curdir): 
		for (thisDir, subsHere, filesHere) in os.walk(startdir): # 
			for name in subsHere + filesHere:
				if fnmatch.fnmatch(name,pattern): 
					fullpath = os.path.join(thisDir,name)
					yield fullpath 

def timeconvert(x):
	convert  = time.strftime("%Y-%m-%d",time.localtime(os.path.getctime(x)))   
	return   convert

print("select action: delete: delete files: copy: copy files: view: view files")
action = input(" ")

if action == "copy":
    print("inter path")
    dest = input(" ") 

else:
    print ("inter date")
    cursive = input("")
    optime  = re.search('20[0-12]\d{1,2}.\d{1,2}',cursive)

if optime == None:
    print ('error')
else:    
	if __name__== '__main__':
		import sys 
		namepattern,startdir, = sys.argv[1],sys.argv[2]
        for name in find(namepattern,startdir): 
        
		
          
		  if not  str(cursive) <= timeconvert(name):   
            if action == 'copy':
                shutil.copy(name, dest)
            
			elif action == 'delete':
                os.remove(name)
			  
            elif  action == "view":
               print(name + timeconvert(name))
            
			else:
                print ('error')

Я по сусекам метён,
По коробам скребён,
На сыром масле мешен,
На окошке стужен;
Я от дедушки ушёл,
Я от бабушки ушёл,
И от тебя убегу.

Запостил: Madhouse_camomile Madhouse_camomile, (Updated )

Комментарии (0) RSS

Добавить комментарий

Переведи на "PHP", guest!

    А не использовать ли нам bbcode?


    8