Article View: alt.privacy.anon-server
Article #215144Re: Utility to rename files
From: admin
Date: Wed, 28 Mar 2007 18:06
Date: Wed, 28 Mar 2007 18:06
59 lines
3401 bytes
3401 bytes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > On Wed, 28 Mar 2007 13:00:03 +0200, Nomen Nescio wrote: > >> i=0; for f in *Stupid*.jpg; do mv $f eelbash$i.jpg; i=$(($i+1)); done That is a nice little piece of code, aside from the childish insult contained in it. It has a couple of problems, however: One is that, all too typically, it is so bare-bones, so lacking in any kind of documentation, that nobody who is a newbie will make much sense of it. For example, how, exactly, do you execute it? From a command line, as part of a python or perl program, or what? How do you control what directory it affects? A couple of good examples might have made those things clear, but the poster couldn't be bothered with details. Very typically thoughtless about the audience of newbies that will be reading this group. The second thing about it that seems lacking, at least from the playing around with it that I've done, is that it seems rigid in how it can be applied to file names. For example, if a folder contains aaabbb.txt and rrrxxxbbb.txt, and you want to rename just the 'bbb' portion of each to, say, 'spqr', so that you end up with aaaspqr.txt and rrrxxxspqr.txt, how do you do that? I don't think the command allows that; you need to write a script to do the parsing of each input file. What I did was to write a script to do just that, and once the file names have been properly massaged, the mv command is run. Please give it a try. I hasten to add that my knowledge of linux and python is at a basic level - I've never pretended otherwise - and there is plenty of room for improvement in the script. Still, it seems to work well. You can ftp it from: ftp://eelbash.yi.org user: eichen password: anything The folder you want is: newnames It's a pity that SofaKing isn't still around. He seemed to know his way around python, and could probably blast out a nice gui front end for something like this, not to mention make it a lot more useful. As it is, you'll have to do with the simple prompts that I was able to put in. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGCq3CCOv6H9XGvoIRAvOCAKCW0Wku4M0FUlWjXHHifPxzKL2+FACeISsK aLRXR2K0tPUhBw6lXliiId4= =BHKJ -----END PGP SIGNATURE-----
Technical Details
Message-ID:
<20070328180628.hcSIStG3jLB7@anonymous.poster>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!nr2.newsreader.com.POSTED!not-for-mailReferences:
<c4362f1eeeba0ad05a32407ebbd43f4f@dizum.com>Show Full Headers
Complete Article Headers
Message-ID: <20070328180628.hcSIStG3jLB7@anonymous.poster> Subject: Re: Utility to rename files Date: Wed, 28 Mar 2007 18:06:28 +0000 From: admin@newsanon.yi.org References: <c4362f1eeeba0ad05a32407ebbd43f4f@dizum.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!nr2.newsreader.com.POSTED!not-for-mail X-Complaints: admin@eelbash.yi.org. Include 777 in the subject to get through the spam filters Newsgroups: alt.privacy.anon-server Lines: 59 Organization: NewsReader.Com Subscriber NNTP-Posting-Host: 38629ec5.nr2.newsreader.com X-Trace: DXC=:Ll:lEOCUF0k_Vgl8^9oX3OA8_@f\K_i2`fX?[=><X54HgE1=eBN8l3LABh<JKKWO=_bKIPMmlm; ?hEAPRnR3ge; CKI\FT>6h_6 X-Complaints-To: abuse@newsreader.com