Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53831
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'subject:Python': 0.06; 'work!': 0.07; 'bash': 0.09; 'executes': 0.09; 'subject:script': 0.09; 'subject:Help': 0.11; 'python': 0.11; 'suggest': 0.14; 'windows': 0.15; '(these': 0.16; 'command,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'need:': 0.16; '{};': 0.16; 'files.': 0.16; 'folder': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'command': 0.22; 'directory.': 0.24; 'fine': 0.24; 'initial': 0.24; 'script': 0.25; 'task': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'sep': 0.31; 'supposed': 0.32; 'run': 0.32; 'linux': 0.33; 'mac': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'so,': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'does': 0.39; 'skip:. 10': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'days': 0.60; 'most': 0.60; "you're": 0.61; 'you.': 0.62; 'charset:windows-1252': 0.65; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=7VwNixiEeZg1OifWT9SbVfbUx3iAEHELmRk99fhQ/as=; b=YPr4JTkLifnxEyjfEkF+r0GNz8tq8bOFXshXNf4cE+uuCiD0ybjeOchF6PYPCBz4np oM5yQqpcD9zP9t7BTKIxgJ3xNa7qWiQh4ihIGnv4qj+gDRncltzoelEMiy5VfQVum/5P QTtBnDNxASbPEPADzoKgdnRccYfhpmnB56lPFcKp295BMFiY/drePdbyNksN7+zzGILS D6O0PgtlQ7zF4xJjGuQObHGuy7eeJmYBH9UepKjYSLjtmuBcgHLDnM8Qt350ZDbwFMlc 3Pw992nDYep0pFJpAtU1/rXadsxnBJi5Hek2/6teOMg9HygUykG3YWIGCs2K10Mo73/5 vI0g== |
| MIME-Version | 1.0 |
| X-Received | by 10.52.249.102 with SMTP id yt6mr8629552vdc.21.1378605385254; Sat, 07 Sep 2013 18:56:25 -0700 (PDT) |
| In-Reply-To | <3f4f33ee-c8e7-4154-a817-c74b26b00301@googlegroups.com> |
| References | <3f4f33ee-c8e7-4154-a817-c74b26b00301@googlegroups.com> |
| Date | Sun, 8 Sep 2013 11:56:25 +1000 |
| Subject | Re: Help - Python syntax - repeats script through subordinate folders |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.147.1378605394.5461.python-list@python.org> (permalink) |
| Lines | 36 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1378605394 news.xs4all.nl 15940 [2001:888:2000:d::a6]:36356 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53831 |
Show key headers only | View raw
On Sun, Sep 8, 2013 at 11:41 AM, BlueFielder <bluefielder@gmail.com> wrote:
> 3. Then I run the script from terminal : python ./fxp2aupreset.py ./ aumu Alb3 LinP vstdata
>
> It executes fine and does it's job.
>
> BUT… I have per 7600 files that are segregated into 86 folders.
> I want to keep this folder structure.
>
> So, What I need the script to do is to start at the parent folder (ddd) and then go through each subordinate (child) folder and perform its task on all files.
>
> I found this syntax on the web that is somehow supposed to do what I need:
>
> for /r %a in (*.fxp) do example.py "%a"
>
> BUT … I have no idea how to combine the syntax.
Your initial command and path suggest you're on a Unix-like system
(these days that most likely means either Linux or Mac OS), but the
FOR command at the end is a Windows command, so that's not going to
work. However, Unix does have a find command, so that should work for
you.
Do you need to run your script once for each file, or once for each
directory? Based on your use of "for /r", I'm thinking once per
directory.
$ find -type d -execdir bash -c 'cd {}; python ./fxp2aupreset.py ./
aumu Alb3 LinP vstdata' \;
I'm sure there's a tidier way to do it, but this should work!
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help - Python syntax - repeats script through subordinate folders BlueFielder <bluefielder@gmail.com> - 2013-09-07 18:41 -0700
Re: Help - Python syntax - repeats script through subordinate folders Chris Angelico <rosuav@gmail.com> - 2013-09-08 11:56 +1000
Re: Help - Python syntax - repeats script through subordinate folders BlueFielder <bluefielder@gmail.com> - 2013-09-07 19:52 -0700
Re: Help - Python syntax - repeats script through subordinate folders BlueFielder <bluefielder@gmail.com> - 2013-09-07 19:59 -0700
Re: Help - Python syntax - repeats script through subordinate folders Chris Angelico <rosuav@gmail.com> - 2013-09-08 13:01 +1000
Re: Help - Python syntax - repeats script through subordinate folders BlueFielder <bluefielder@gmail.com> - 2013-09-07 20:09 -0700
Re: Help - Python syntax - repeats script through subordinate folders Michael Torrie <torriem@gmail.com> - 2013-09-07 21:34 -0600
Re: Help - Python syntax - repeats script through subordinate folders Chris Angelico <rosuav@gmail.com> - 2013-09-08 13:37 +1000
Re: Help - Python syntax - repeats script through subordinate folders BlueFielder <bluefielder@gmail.com> - 2013-09-07 20:54 -0700
csiph-web