Re: How do I remove/unlink wildcarded files

2015-01-08 Thread Marko Rauhamaa
Rick Johnson : > If history has taught us anything, it is that, intelligence will > *ALWAYS* defeat brute strength, and that the *MOST* intelligent > societies are consequently those who possess both a humbled respect > for freedom, and a vile rejection of oppression. Impressive. With such a high

Re: How do I remove/unlink wildcarded files

2015-01-08 Thread Rick Johnson
On Thursday, January 8, 2015 7:11:45 AM UTC-6, Albert van der Horst wrote: > Rick Johnson wrote: > >Widespread centralized free schooling did not exists until > >almost the 1900's. Heck, looking back at American history, > >the world *SHOULD* be in awe. To go from a rag-tag > >illiterate bunch of c

Re: How do I remove/unlink wildcarded files

2015-01-08 Thread Albert van der Horst
In article , Rick Johnson wrote: >On Saturday, January 3, 2015 4:39:25 AM UTC-6, Mark Lawrence wrote: > >> I used to get very confused watching the old westerns. The child when >> talking about "more" and "paw" wasn't referring to possibly an >> adjective, noun or adverb and a part of an animal,

Re: OT Vernacular and empire building [was Re: How do I remove/unlink wildcarded files]

2015-01-04 Thread Rick Johnson
On Sunday, January 4, 2015 7:19:23 AM UTC-6, Steven D'Aprano wrote: > Dear gods, I know I'm going to regret this... [...] Yes, but *NOT* for the reason you think! With all the intellectual and philosophical *GOLD* i have dropped into this thread (and others), the only response you can muster is t

OT Vernacular and empire building [was Re: How do I remove/unlink wildcarded files]

2015-01-04 Thread Steven D'Aprano
Dear gods, I know I'm going to regret this... Mark Lawrence wrote: > On 03/01/2015 17:53, Rick Johnson wrote: >> On Saturday, January 3, 2015 4:39:25 AM UTC-6, Mark Lawrence wrote: >> >>> I used to get very confused watching the old westerns. The child when >>> talking about "more" and "paw" w

Re: How do I remove/unlink wildcarded files

2015-01-03 Thread Mark Lawrence
On 03/01/2015 17:53, Rick Johnson wrote: On Saturday, January 3, 2015 4:39:25 AM UTC-6, Mark Lawrence wrote: I used to get very confused watching the old westerns. The child when talking about "more" and "paw" wasn't referring to possibly an adjective, noun or adverb and a part of an animal, b

Re: How do I remove/unlink wildcarded files

2015-01-03 Thread Rick Johnson
On Saturday, January 3, 2015 4:39:25 AM UTC-6, Mark Lawrence wrote: > I used to get very confused watching the old westerns. The child when > talking about "more" and "paw" wasn't referring to possibly an > adjective, noun or adverb and a part of an animal, but what we would > refer to in the

Re: How do I remove/unlink wildcarded files

2015-01-03 Thread Mark Lawrence
On 03/01/2015 10:16, Chris Angelico wrote: On Sat, Jan 3, 2015 at 9:01 PM, Steven D'Aprano wrote: Chris Angelico wrote: On Sat, Jan 3, 2015 at 4:54 AM, Rustom Mody wrote: And how does this strange language called English fits into your rules and (no) special cases scheme? http://www.omgf

Re: How do I remove/unlink wildcarded files

2015-01-03 Thread Chris Angelico
On Sat, Jan 3, 2015 at 9:01 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> On Sat, Jan 3, 2015 at 4:54 AM, Rustom Mody wrote: >>> And how does this strange language called English fits into your rules >>> and (no) special cases scheme? >>> >>> > http://www.omgfacts.com/lists/3989/Did-you

Re: How do I remove/unlink wildcarded files

2015-01-03 Thread Steven D'Aprano
Chris Angelico wrote: > On Sat, Jan 3, 2015 at 4:54 AM, Rustom Mody wrote: >> And how does this strange language called English fits into your rules >> and (no) special cases scheme? >> >> http://www.omgfacts.com/lists/3989/Did-you-know-that-ough-can-be-pronounced-TEN-DIFFERENT-WAYS > > I learne

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Gregory Ewing
Chris Angelico wrote: On Sat, Jan 3, 2015 at 4:15 AM, Rick Johnson wrote: Those who refuse to be a part of the modern world can suffer the troubles of forking the code into their ancient systems -- and i will not loose any sleep over the issue. By the way, is this "loose" part of your "moder

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Rick Johnson
On Friday, January 2, 2015 11:54:49 AM UTC-6, Rustom Mody wrote: > And how does this strange language called English fits > into your rules and (no) special cases scheme? Oh i'm not blind to the many warts of the English language, for it has many undesirable qualities indeed, however, it *is* the

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Chris Angelico
On Sat, Jan 3, 2015 at 4:15 AM, Rick Johnson wrote: > Those who refuse to be a part of the modern world can > suffer the troubles of forking the code into their ancient > systems -- and i will not loose any sleep over the issue. By the way, is this "loose" part of your "modern world", or is that

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Chris Angelico
On Sat, Jan 3, 2015 at 4:54 AM, Rustom Mody wrote: > And how does this strange language called English fits into your rules > and (no) special cases scheme? > > http://www.omgfacts.com/lists/3989/Did-you-know-that-ough-can-be-pronounced-TEN-DIFFERENT-WAYS I learned six, which is no more than ther

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Rustom Mody
On Friday, January 2, 2015 10:45:17 PM UTC+5:30, Rick Johnson wrote: > On Friday, January 2, 2015 8:01:50 AM UTC-6, Chris Angelico wrote: > > I'm not sure that I'd want to. Handling case insensitivity is fine > > when you're restricting everything to ASCII, but it's rather harder > > when you allow

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Rick Johnson
On Friday, January 2, 2015 8:01:50 AM UTC-6, Chris Angelico wrote: > I'm not sure that I'd want to. Handling case insensitivity is fine > when you're restricting everything to ASCII, but it's rather harder > when you allow all of Unicode. For instance, U+0069 and U+0049 would > be considered case-i

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Mark Lawrence
On 02/01/2015 14:01, Chris Angelico wrote: On Sat, Jan 3, 2015 at 12:51 AM, Ervin Hegedüs wrote: it may be at the concrete example in OP is better the glob - but I think in most cases the re modul gives more flexibility, I mean the glob modul can handle the upper/lower chars? I'm not sure tha

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Chris Angelico
On Sat, Jan 3, 2015 at 1:10 AM, Ervin Hegedüs wrote: > I didn't want to solve the OP's problem - I just gave an idea. > Here was another possible solution, I think the OP can choose the > right one :) Heh. Fortunately, even in cases where the OP can't recognize the right choice, the rest of pytho

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi Chris, On Sat, Jan 03, 2015 at 01:01:31AM +1100, Chris Angelico wrote: > On Sat, Jan 3, 2015 at 12:51 AM, Ervin Hegedüs wrote: > > it may be at the concrete example in OP is better the glob - but > > I think in most cases the re modul gives more flexibility, I mean > > the glob modul can handl

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Chris Angelico
On Sat, Jan 3, 2015 at 12:51 AM, Ervin Hegedüs wrote: > it may be at the concrete example in OP is better the glob - but > I think in most cases the re modul gives more flexibility, I mean > the glob modul can handle the upper/lower chars? I'm not sure that I'd want to. Handling case insensitivit

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Fri, Jan 02, 2015 at 11:59:17PM +1100, Chris Angelico wrote: > On Fri, Jan 2, 2015 at 11:36 PM, Ervin Hegedüs wrote: > >> And worse, the given re would delete a file named "uni" which doesn't > >> sound ANYTHING like what the OP wanted :-) > > > > yes, you're right - I've missed out a "."

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Chris Angelico
On Fri, Jan 2, 2015 at 11:36 PM, Ervin Hegedüs wrote: >> And worse, the given re would delete a file named "uni" which doesn't >> sound ANYTHING like what the OP wanted :-) > > yes, you're right - I've missed out a "." before the "*". :) Another reason to avoid regexps when you don't actually nee

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Fri, Jan 02, 2015 at 05:35:52AM -0600, Tim Chase wrote: > On 2015-01-02 21:21, Cameron Simpson wrote: > > >def unlinkFiles(): > > >dirname = "/path/to/dir" > > >for f in os.listdir(dirname): > > >if re.match("^unix*$", f): > > >os.remove(os.path.join(dirname, f))

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Tim Chase
On 2015-01-02 21:21, Cameron Simpson wrote: > >def unlinkFiles(): > >dirname = "/path/to/dir" > >for f in os.listdir(dirname): > >if re.match("^unix*$", f): > >os.remove(os.path.join(dirname, f)) > > That is a very expensive way to check the filename in this > particula

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread MRAB
On 2015-01-02 10:21, Cameron Simpson wrote: On 02Jan2015 10:00, Ervin Hegedüs wrote: On Thu, Jan 01, 2015 at 05:13:31PM -0600, Anthony Papillion wrote: I have a function I'm writing to delete wildcarded files in a directory. I tried this: def unlinkFiles(): os.remove("/home/anthony/backup

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Fri, Jan 02, 2015 at 09:21:53PM +1100, Cameron Simpson wrote: > On 02Jan2015 10:00, Ervin Hegedüs wrote: > >On Thu, Jan 01, 2015 at 05:13:31PM -0600, Anthony Papillion wrote: > >>I have a function I'm writing to delete wildcarded files in a directory. > >>I tried this: > >> > >>def unlinkF

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Cameron Simpson
On 02Jan2015 10:00, Ervin Hegedüs wrote: On Thu, Jan 01, 2015 at 05:13:31PM -0600, Anthony Papillion wrote: I have a function I'm writing to delete wildcarded files in a directory. I tried this: def unlinkFiles(): os.remove("/home/anthony/backup/unix*") This doesn't seem to work because i

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ervin Hegedüs
Hi, On Thu, Jan 01, 2015 at 05:13:31PM -0600, Anthony Papillion wrote: > Hi Everyone, > > I have a function I'm writing to delete wildcarded files in a directory. > I tried this: > > def unlinkFiles(): > os.remove("/home/anthony/backup/unix*") > > This doesn't seem to work because it's a wi

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Ben Finney
Anthony Papillion writes: > I have a function I'm writing to delete wildcarded files in a > directory. Is the brute-force method (explicit, easy to understand) good enough? import os import os.path import glob paths_to_remove = glob.glob( os.path.join([

Re: How do I remove/unlink wildcarded files

2015-01-02 Thread Emil Oppeln-Bronikowski
This doesn't seem to work because it's a wildcard filename. What is the proper way to delete files using wildcards? You could try glob[1] and then iterate over collected list (it also gives you a chance to handle errors like unreadable/not owned by you files). [1] https://docs.python.org/2/

How do I remove/unlink wildcarded files

2015-01-02 Thread Anthony Papillion
Hi Everyone, I have a function I'm writing to delete wildcarded files in a directory. I tried this: def unlinkFiles(): os.remove("/home/anthony/backup/unix*") This doesn't seem to work because it's a wildcard filename. What is the proper way to delete files using wildcards? Thanks, Anthony