Question: Hello, I havent worked with python in a couple years so my skills are a bit rusty. I am trying to develop a python script
Hello,
I havent worked with python in a couple years so my skills are a bit rusty. I am trying to develop a python script that does a couple things.
Why I need this script is because the company I intern for sends all its orders from the website and API to a couple documents folders the main one I need is called summary. In summary there thousands of files. Every file I need looks like this WEB######.sum and WEB######.txt . What I need is a script that combs this folder based on a user inputted date. The date would refer to the last date modified. Each order has two files the .sum and the .txt, and every order is in sequential order Like:
WEB330542.sum
WEB330542.txt
WEB330543.sum
WEB330543.txt
WEB330544.sum
WEB330544.txt
The script needs to be programmed in a way the can report back if one of the files in order is missing. Whether that be if theres only one file missing or two.
Ive been working on this for some time and I found a way to list everything with the date modified. Im very frustrated with this so any help would be greatly appreciated. I am using python 3.6.5. The image is two different way ive tried to approach the problem.
Thanks!
Fle List by Dste.p eLst by Dste.py.a C | |?"Bumblebee.or-cA 3050 Fiu Edt Fumal Run Opliona Winduw Hul fEil L?st by date impozt glob ront = 'C: \ \python\\" Bumblcbee file viewer #5/1/2,018 purpaso - altiple furctions of thc program ?w view files in 1h? 10.203. 11.7 Sumaty folder tid uuupu?dny #discrepancies within a given time trame #2-1f ther is a discrepancy to look in the "error . folder for the specific fil f3.poaa ?hly taka aach ri1a and Inad them, into an array (i havs to think bout. th?a) tapproach -sort all the filos in the uary toldor by date. ro that chock to sec if Fol dar ot Choice fzoot-"\\\\?0.203.110.7\\\Polli: q\ \ *" qrabs subfolders in pollinq ?rou choose the Directory date tile listI #initia i za variab IAA for folder in qlob.glob (root): print older-. foldar tll files would bc fut file in glob . glub { folder but auspense files would ba '.auError -'cr' ?name-input("What is your name? + "/t. *'); tats-os.stat (ilc) lactmod datainput "Enter your dace:" dat til tupla-lastmod data, til # Sorta tna tipiaa by data impozt datetime SCInl Hqettimestamp-O der abtainnatA: date fila_list.append (date file_tuple) - print date_filc_list iavalid-alse date til^ is..sort()?3orts by tirat date rdate fila_list.IeveEse userinl -input ("lesse type you irst date dd/mm yy:" print ("4-40s62" ("filenanc.", "last modified :")) tolder, tile nama-os.patn.spL?t(tiLa l11) file date- time.strftime ('' ?/ed/ty?:?:8s", dl -datetime.datetima.strptime usarInl,"d/sm/sy" d2-datetine.datetine.strptinusrIn2, "di" file [0]) eturn userInl,usarIn2) print (obtainDate) dat got timastamp: start -cibtain_pate ?liput?"Please typ? your first date dd/mm/yy: ")) locstion -(C: python f start
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
