<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How can I automatically remove characters from 200 filenames?</title>
	<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames/</link>
	<description>Comments on Ask MetaFilter post How can I automatically remove characters from 200 filenames?</description>
	<pubDate>Sun, 23 Jan 2005 19:15:52 -0800</pubDate>
	<lastBuildDate>Sun, 23 Jan 2005 19:15:52 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How can I automatically remove characters from 200 filenames?</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames</link>	
		<description>&lt;b&gt;Six characters, in search of a way to replace them&lt;/b&gt;&lt;br&gt;
I have a series of files whose names I&apos;d like to edit by taking out part of the name and replacing it but the part I&apos;d like to remove from each file name is different. [more] &lt;br /&gt;&lt;br /&gt; I have more than 200 files whose names look like this:&lt;br&gt;
filename.garbage.000&lt;br&gt;
filename.garbage.001&lt;br&gt;
filename.garbage.002&lt;br&gt;
etc.&lt;br&gt;
In each file, the garbage I&apos;d like to remove is six characters between the two dots, and there seems to be some kind of sequence to them (#3E3A0, #3E3A1, #3E3A2, etc.) but they all need to go. I guess one of the dots needs to go, too. Since the garbage in each file is different, that screws up the ordering of the part numbers at the end of the filenames and we can&apos;t have that.&lt;br&gt;
&lt;br&gt;
I&apos;m using OS X and I&apos;ve tried the various filename-editing Applescripts I have, but those haven&apos;t done what I wanted them to. (Unless I was doing it wrong.) Any Applescript or Terminal gods out there?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2005:site.14344</guid>
		<pubDate>Sun, 23 Jan 2005 19:13:48 -0800</pubDate>
		<dc:creator>emelenjr</dc:creator>
		
			<category>Mac</category>
		
			<category>OSX</category>
		
			<category>file</category>
		
			<category>rename</category>
		
			<category>resolved</category>
		
	</item> <item>
		<title>By: emelenjr</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247022</link>	
		<description>And, I should have mentioned, it would be best if the garbage could be replaced by a filename extension. Thank you to anyone willing to guide me.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247022</guid>
		<pubDate>Sun, 23 Jan 2005 19:15:52 -0800</pubDate>
		<dc:creator>emelenjr</dc:creator>
	</item><item>
		<title>By: sanko</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247033</link>	
		<description>&lt;a href=&quot;http://www.evolt.org/article/Renaming_Files_with_Perl/17/351/&quot;&gt;This Perl script&lt;/a&gt; looks like it should do the trick.  My regexp skills are a bit rusty so I&apos;m not sure what arguments you&apos;ll need to feed the script, but there are &lt;a href=&quot;http://www.google.com/search?hl=en&amp;lr=&amp;safe=off&amp;c2coff=1&amp;client=firefox-a&amp;rls=org.mozilla%3Aen-US%3Aofficial&amp;q=perl+regular+expressions+tutorial&amp;btnG=Search&quot;&gt;tons of resources&lt;/a&gt; available for that.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247033</guid>
		<pubDate>Sun, 23 Jan 2005 19:32:17 -0800</pubDate>
		<dc:creator>sanko</dc:creator>
	</item><item>
		<title>By: Wood</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247036</link>	
		<description>Check out &lt;a href=&quot;http://hp.vector.co.jp/authors/VA014830/english/FlexRena/&quot;&gt;flexible renamer&lt;/a&gt; for what looks to be a pretty beefy GUI for this sort of thing.  I&apos;ve only used it a couple times but it looks like there&apos;s probably 10 different ways it could solve your problem.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247036</guid>
		<pubDate>Sun, 23 Jan 2005 19:39:03 -0800</pubDate>
		<dc:creator>Wood</dc:creator>
	</item><item>
		<title>By: Wood</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247039</link>	
		<description>That&apos;s a windows program.  Darn, reading comprehension not what it should be.  Oh well, my link might help someone (if it weren&apos;t for the fact that I probably found here on ask me anyway.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247039</guid>
		<pubDate>Sun, 23 Jan 2005 19:40:23 -0800</pubDate>
		<dc:creator>Wood</dc:creator>
	</item><item>
		<title>By: Jeff Howard</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247041</link>	
		<description>I&apos;d also look into &lt;a href=&quot;http://www.publicspace.net/ABetterFinderRename/&quot;&gt;A Better Finder Rename&lt;/a&gt;. It&apos;s for exactly this type of thing.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247041</guid>
		<pubDate>Sun, 23 Jan 2005 19:40:48 -0800</pubDate>
		<dc:creator>Jeff Howard</dc:creator>
	</item><item>
		<title>By: Jeff Howard</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247044</link>	
		<description>For OSX.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247044</guid>
		<pubDate>Sun, 23 Jan 2005 19:41:59 -0800</pubDate>
		<dc:creator>Jeff Howard</dc:creator>
	</item><item>
		<title>By: emelenjr</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247045</link>	
		<description>I&apos;ll look into the Per scripts, but Flexible Renamer is a Windows app, which I can&apos;t use. Thanks for looking, though. I&apos;m checking Versiontracker for my options there, too.&lt;br&gt;
&lt;br&gt;
On preview, thanks Jeff. And thanks for the effort anyway, Wood.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247045</guid>
		<pubDate>Sun, 23 Jan 2005 19:43:42 -0800</pubDate>
		<dc:creator>emelenjr</dc:creator>
	</item><item>
		<title>By: 445supermag</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247056</link>	
		<description>Awk can be used for this sort of thing, I assume macs have it available in the terminal window. Lots of Awk scripting examples on the web.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247056</guid>
		<pubDate>Sun, 23 Jan 2005 20:26:11 -0800</pubDate>
		<dc:creator>445supermag</dc:creator>
	</item><item>
		<title>By: stavrosthewonderchicken</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247068</link>	
		<description>Sorry this doesn&apos;t help the original poster, but if anyone&apos;s looking for a tool for Windows, thi&lt;a href=&quot;http://go.to/lupas2000&quot;&gt;s one&lt;/a&gt; is by far the best I&apos;ve found.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247068</guid>
		<pubDate>Sun, 23 Jan 2005 20:47:34 -0800</pubDate>
		<dc:creator>stavrosthewonderchicken</dc:creator>
	</item><item>
		<title>By: nicwolff</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247097</link>	
		<description>Welcome to Unix! Here what you want (you type the bold bits):&lt;br&gt;
&lt;br&gt;
% &lt;b&gt;foreach f ( filename.* )&lt;/b&gt;&lt;br&gt;
foreach? &lt;b&gt;mv $f $f:r:r.$f:e&lt;/b&gt;&lt;br&gt;
foreach? &lt;b&gt;end&lt;/b&gt;&lt;br&gt;
&lt;br&gt;
What&apos;s happening here? tcsh is the default shell under OS X, and &quot;foreach&quot; is the tcsh loop operator. (The &quot;%&quot; in the first line represents the prompt; don&apos;t type that.) So the first line is you telling the shell to loop through all files in the current directory whose names start with &quot;filename.&quot;.&lt;br&gt;
&lt;br&gt;
The next line is foreach&apos;s prompt followed by your telling the shell what you want to do to each of those filenames. &quot;mv&quot; is the Unix &quot;move&quot; or &quot;rename&quot; command. &quot;$f&quot; refers back to the &quot;f&quot; variable you told the shell to assign to each filename. &quot;:r&quot; means &quot;the root&quot; - that is, take the extension off the filename. We do it twice to get rid of both the &quot;.001&quot; and the &quot;.garbage&quot;. Then we add back on a &quot;.&quot; and the &quot;001&quot; extension, which we get using &quot;:e&quot;. &lt;br&gt;
&lt;br&gt;
Once we enter &quot;end&quot; the &quot;foreach&quot; command executes and renames the files.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247097</guid>
		<pubDate>Sun, 23 Jan 2005 21:48:37 -0800</pubDate>
		<dc:creator>nicwolff</dc:creator>
	</item><item>
		<title>By: emelenjr</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247120</link>	
		<description>Thanks for explaining that, nicwolff. From your example, I think I understand what to do in my case. But I am lazy, so I downloaded A Better Finder Rename. And I am cheap, so I used the program unregistered to handle renaming the files ten at a time. Next time I need to do something like that, I&apos;ll give your method a shot.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247120</guid>
		<pubDate>Sun, 23 Jan 2005 23:27:51 -0800</pubDate>
		<dc:creator>emelenjr</dc:creator>
	</item><item>
		<title>By: cyrusdogstar</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247372</link>	
		<description>Just a note for future reference, &lt;b&gt;nicwolff&lt;/b&gt;, but tcsh has been pre-empted in OSX 10.3+ by the good old almost-all-Linux-distros-have-it-as-the-default-shell &apos;bash&apos; instead. FYI =) I don&apos;t know if bash has foreach but it does have &apos;for [variable name] in [list] do [command list]; done&apos; which works fairly well.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247372</guid>
		<pubDate>Mon, 24 Jan 2005 10:53:53 -0800</pubDate>
		<dc:creator>cyrusdogstar</dc:creator>
	</item><item>
		<title>By: kindall</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247450</link>	
		<description>New accounts you create under 10.3 will have bash as the default shell, but accounts that already existed when you upgraded will still have tcsh as their shell if it hasn&apos;t been changed.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247450</guid>
		<pubDate>Mon, 24 Jan 2005 13:00:04 -0800</pubDate>
		<dc:creator>kindall</dc:creator>
	</item><item>
		<title>By: kchristidis</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247473</link>	
		<description>(&lt;a href=&quot;http://ask.metafilter.com/mefi/14344#247097&quot;&gt;Nicwolff&lt;/a&gt; and &lt;a href=&quot;http://ask.metafilter.com/mefi/14344#247068&quot;&gt;stavros&lt;/a&gt;, thanks to both of you for that guide and link, respectively.)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247473</guid>
		<pubDate>Mon, 24 Jan 2005 13:36:18 -0800</pubDate>
		<dc:creator>kchristidis</dc:creator>
	</item><item>
		<title>By: nicwolff</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#247491</link>	
		<description>Thanks for the heads-up, cyrus and kindall. emelenjr, of course you can just start a tcsh shell by typing &quot;&lt;b&gt;tcsh&lt;/b&gt;&quot; if you want to use my shell trick unmodified - bash has &quot;for...in...&quot; but I&apos;m not sure how it does &quot;:r&quot; and &quot;:e&quot;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-247491</guid>
		<pubDate>Mon, 24 Jan 2005 14:01:54 -0800</pubDate>
		<dc:creator>nicwolff</dc:creator>
	</item><item>
		<title>By: stoneegg21</title>
		<link>http://ask.metafilter.com/14344/How-can-I-automatically-remove-characters-from-200-filenames#248408</link>	
		<description>Using &lt;a href=&quot;http://www.1-4a.com/rename/&quot;&gt;File Renamer&lt;/a&gt; would probably do this pretty easily.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2005:site.14344-248408</guid>
		<pubDate>Tue, 25 Jan 2005 21:19:11 -0800</pubDate>
		<dc:creator>stoneegg21</dc:creator>
	</item>
	</channel>
</rss>
