leftover pyc files
Chris Angelico
rosuav at gmail.com
Thu Nov 3 17:36:15 EDT 2011
On Fri, Nov 4, 2011 at 4:54 AM, Andrea Crotti <andrea.crotti.0 at gmail.com> wrote:
> All these ideas (shell and git hooks) are nice, but unfortunately
> - it's svn not git
> - it's windows not *nix
> - we have to remove only the ones without the corresponding *py...
Windows? Well, Windows shell scripting isn't quite as rich as
bash/csh/etc, but it's possible. I'll leave recursion as an exercise
for the reader, but this (untested) should do it for one directory:
for %d in (*.pyc) do (
set fn=%d
if not exist !fn:~0,-1! del %d
)
This needs to be run with 'cmd /v' to enable delayed variable
evaluation. Of course, it'd be really easy to do if Windows Batch had
anything like decent string manipulation.
ChrisA
More information about the Python-list
mailing list