I post a crappy solution but I can add few more stuff to make it fail
proof.
i.e. I can search for ".exe -u"
But if someone names folder like "folder.exe u". This script could
fail.
Or if in padded garbase I get ".exe u"

These are two known issues I have to takcle.

Thanks everyone for your help.



Grant Edwards wrote:
> On 2006-08-16, Hitesh <[EMAIL PROTECTED]> wrote:
>
> > anything after .exe should be truncated (or deleted).
>
> That will fail if any directory names contain the string
> ".exe", but if that's what you want, it's trivial enough:
>
> for s in ["asdfasdf.exe -u", "soemthing/else", 
> "asdf.exe/qwerqwer/qwerqwer.exe"]:
>     print `s`,
>     i = s.find(".exe")
>     print i,
>     if i >= 0:
>         s = s[:i+4]
>     print `s`
>
> --
> Grant Edwards                   grante             Yow!  Yow! It's some people
>                                   at               inside the wall! This is
>                                visi.com            better than mopping!

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to