[Tutor] (no subject)

2019-03-22 Thread Matthew Herzog
I have a Python3 script that reads the first eight characters of every filename in a directory in order to determine whether the file was created before or after 180 days ago based on each file's name. The file names all begin with MMDD or erased_MMDD_etc.xls. I can collect all these filena

Re: [Tutor] (no subject)

2019-03-26 Thread Matthew Herzog
elif fileDate = datetime.strptime(name[0:8], DATEFMT).date(): ^ SyntaxError: invalid syntax On Sat, Mar 23, 2019 at 6:43 PM Mats Wichmann wrote: > On 3/23/19 3:16 AM, Peter Otten wrote: > > > Personally I would use a try...except clause because with that you can > > handle

[Tutor] operate on files based on comparing filenames to today's date

2019-03-28 Thread Matthew Herzog
I have cobbled together this code which gives me regex matches of files whose names either begin with either MMDD_? or erased_YYMMDD_? and whose extensions are exml or ewav. Now I need to compare the date string (regex match) in the filename to today's date. If the result of the comparison resu