Opinion on best practice...
Grant Edwards
invalid at invalid.invalid
Tue Feb 5 08:22:02 EST 2013
On 2013-02-05, Anthony Correia <akcorreia at gmail.com> wrote:
> I need to pick up a language that would cover the Linux platform.
Well, you haven't really described what it is you're trying to do, but
it looks to me like bash and the usual set of shell utilities (e.g.
find) is what you need rather than Python.
> I use Powershell for a scripting language on the Windows side of
> things. Very simple copy files script. Is this the best way to do
> it?
That depends. What is "it"?
> import os
>
> objdir = ("C:\\temp2")
> colDir = os.listdir(objdir)
> for f in colDir:
> activefile = os.path.join(objdir + "\\" + f)
> print ("Removing " + activefile + " from " + objdir)
> os.remove(activefile)
>
> In Powershell I would just do:
>
> $colDir = gci -path "c:\temp2"
> ForEach($file in $colDir)
Sorry, I'm a Linux guy. I have no clue what that means.
--
Grant Edwards grant.b.edwards Yow! Well, I'm INVISIBLE
at AGAIN ... I might as well
gmail.com pay a visit to the LADIES
ROOM ...
More information about the Python-list
mailing list