Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python for File Systems Manipulation Purging

Cant Proceed

Im sure im not understanding the question

purging.py
import os

def delete_by_date(date_string):
    for entry in os.scandir('backups'):
        if entry.is_file() and date_string in entry.name:
            os.remove(entry.path)
    return

def delete_by_user(username):
    for entry in os.scandir(username):
        if entry.is_file() and date_string in entry.name:
            os.remove(entry.path)
    return

2 Answers

Steven Parker
Steven Parker
231,236 Points

I think you have the right idea, but there's no "date_string" parameter in the second function. Did you mean "username" instead?

Thanks saw my mistake

def delete_by_user(username):
    for entry in os.scandir('backups'):
        if entry.is_file() and username in entry.name:
            os.remove(entry.path)
    return
Steven Parker
Steven Parker
231,236 Points

:warning: FYI: Explicit answers without any explanation are strongly discouraged by Treehouse and may be redacted by moderators.