<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>S.G. Vulcan &#187; folder</title>
	<atom:link href="http://www.sgvulcan.com/tag/folder/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sgvulcan.com</link>
	<description>Silviu&#039;s tech blog. Resources and informations about linux, windows, symbian systems, networks, reviews, microcontrollers, and more.</description>
	<lastBuildDate>Wed, 01 Feb 2012 09:20:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Rename all files in a folder from upper to lower case.</title>
		<link>http://www.sgvulcan.com/rename-all-files-in-a-folder-from-upper-to-lower-case/</link>
		<comments>http://www.sgvulcan.com/rename-all-files-in-a-folder-from-upper-to-lower-case/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 10:49:35 +0000</pubDate>
		<dc:creator>silviu</dc:creator>
				<category><![CDATA[Bash scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[rename]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.sgvulcan.com/?p=717</guid>
		<description><![CDATA[Sometimes is needed to have all files in a folder in the same case. Here&#8217;s a small script to rename all files in the folder to lower case: View Code BASH1 for i in *; do mv $i `echo $i &#124; tr &#91;:upper:&#93; &#91;:lower:&#93;`; done]]></description>
			<content:encoded><![CDATA[<p>Sometimes is needed to have all files in a folder in the same case. Here&#8217;s a small script to rename all files in the folder to lower case:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p717code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7172"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p717code2"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>:upper:<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>:lower:<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><p> </p>
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-7825242150714747";
/* Dupa articol 468x60, created 8/19/09 */
google_ad_slot = "8916341192";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.sgvulcan.com/rename-all-files-in-a-folder-from-upper-to-lower-case/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking directory sizes from the BASH prompt</title>
		<link>http://www.sgvulcan.com/checking-directory-sizes-from-bash-prompt/</link>
		<comments>http://www.sgvulcan.com/checking-directory-sizes-from-bash-prompt/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 20:18:16 +0000</pubDate>
		<dc:creator>silviu</dc:creator>
				<category><![CDATA[Bash scripting]]></category>
		<category><![CDATA[Tips and tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[pipe]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://www.sgvulcan.com/?p=697</guid>
		<description><![CDATA[The command ls can be made to show directories and permission but it will not display directory sizes. Then it&#8217;s time for other commands. For example on my hosting account there is no file manager installed and evidently x and kde is missing too so, to find out directory sizes I can use the du command. It will show something like this: View Code BASH1 2 3 4 5 6 $ du -h --max-depth=1 3.2M    ./wp-admin 24M     ./wp-content 5.9M    ./wp-includes 4.0K    ./cgi-bin 44M     . BTW the command above shows a typical WordPress installation. What I used was the switch -h which provides human readable sizes for folders (like Kilo, Giga, Tera, etc.) and I also used the swithc &#8211;max-depth to tell du only to go one folder deep otherwise it will also show the sizes of every subfolder from the current one down. Should you like to have those results sorted it&#8217;s only a matter of piping the results of du into sort, like this: View Code BASH1 2 3 4 5 6 $ du -h --max-depth=1 &#124; sort -nr 44M     . 24M     ./wp-content 5.9M    ./wp-includes 4.0K    ./cgi-bin 3.2M    ./wp-admin What sort does is &#8211; surprise, sort it&#8217;s input. The [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-698" title="bash_script" src="http://www.sgvulcan.com/wp-content/uploads/2010/01/bash_script.jpg" alt="" width="150" height="54" />The command<strong> ls </strong>can be made to show directories and permission but it will not display directory sizes. Then it&#8217;s time for other commands. For example on my hosting account there is no file manager installed and evidently x and kde is missing too so, to find out directory sizes I can use the <strong>du </strong>command. It will show something like this:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p697code5'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6975"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p697code5"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> <span style="color: #660033;">--max-depth</span>=<span style="color: #000000;">1</span>
3.2M    .<span style="color: #000000; font-weight: bold;">/</span>wp-admin
24M     .<span style="color: #000000; font-weight: bold;">/</span>wp-content
5.9M    .<span style="color: #000000; font-weight: bold;">/</span>wp-includes
4.0K    .<span style="color: #000000; font-weight: bold;">/</span>cgi-bin
44M     .</pre></td></tr></table></div>

<p>BTW the command above shows a typical WordPress installation. What I used was the switch -h which provides human readable sizes for folders (like Kilo, Giga, Tera, etc.) and I also used the swithc &#8211;max-depth to tell du only to go one folder deep otherwise it will also show the sizes of every subfolder from the current one down.</p>
<p>Should you like to have those results sorted it&#8217;s only a matter of piping the results of <strong>du </strong>into <strong>sort</strong>, like this:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p697code6'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6976"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p697code6"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> <span style="color: #660033;">--max-depth</span>=<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
44M     .
24M     .<span style="color: #000000; font-weight: bold;">/</span>wp-content
5.9M    .<span style="color: #000000; font-weight: bold;">/</span>wp-includes
4.0K    .<span style="color: #000000; font-weight: bold;">/</span>cgi-bin
3.2M    .<span style="color: #000000; font-weight: bold;">/</span>wp-admin</pre></td></tr></table></div>

<p>What <strong>sort </strong>does is &#8211; surprise, sort it&#8217;s input. The switches used are <strong>-n</strong> to tell sort to sort by numerical values and <strong>-r</strong> to reverse the results (from big to small). Of course from here on you can pipe to text files, use even more complicated constructs but this should take care of the base.</p>
<p>If you managed to sort your folders how about sorting my wish list <img src='http://www.sgvulcan.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  don&#8217;t forget to click a sponsor.</p>
<div id="in_post_ad_bottom_1" style="clear:both;margin: 5px;padding: 0px;"><p> </p>
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "pub-7825242150714747";
/* Dupa articol 468x60, created 8/19/09 */
google_ad_slot = "8916341192";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></div><div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://www.sgvulcan.com/checking-directory-sizes-from-bash-prompt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

