Page 1 of 1

[SOLVED] Delete multiple files

Published: Dec 3, 2018 - 3:02 PM
by lowix
Hello community!

I'm trying to delete multiple files based on their extension using the "remove_file" function, and I was wondering if it's possible to use a wildcard character like this:

Code: Select all

remove_file(r'C:\Users\Public\Desktop\*.lnk') 
Thank you in advance for your reply ;)

Re: Question about remove_file

Published: Dec 3, 2018 - 3:10 PM
by htouvet
not directly...

Code: Select all

import glob

def install():
    for filename in glob.glob(r'C:\Users\Public\Desktop\*.lnk'):
        delete_file(filename)
        

Re: Question about remove_file

Published: Dec 3, 2018 - 3:59 PM
by lowix
htouvet wrote: Dec 3, 2018 - 3:10 PM not directly...

Code: Select all

import glob

def install():
    for filename in glob.glob(r'C:\Users\Public\Desktop\*.lnk'):
        delete_file(filename)
        
tremendous !

Re: Question about remove_file

Published: Dec 3, 2018 - 4:20 PM
by lowix
htouvet wrote: Dec 3, 2018 - 3:10 PM not directly...

Code: Select all

import glob

def install():
    for filename in glob.glob(r'C:\Users\Public\Desktop\*.lnk'):
        delete_file(filename)
        
However, unless I'm mistaken, it's a remove_file and not a delete_file
THANKS