Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Opinion on best practice... Date: Tue, 5 Feb 2013 13:22:02 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 35 Message-ID: References: <207d17ce-4bc7-487c-acde-6a7b9f66002b@googlegroups.com> NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1360070522 19026 64.122.56.22 (5 Feb 2013 13:22:02 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Tue, 5 Feb 2013 13:22:02 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:38189 On 2013-02-05, Anthony Correia 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 ...