<?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>TechieDrill &#187; simple</title>
	<atom:link href="http://techiedrill.com/tag/simple/feed/" rel="self" type="application/rss+xml" />
	<link>http://techiedrill.com</link>
	<description>Your World Of Technical Tutorials</description>
	<lastBuildDate>Tue, 10 Aug 2010 20:39:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Creating Folders using simple Java</title>
		<link>http://techiedrill.com/2009/11/creating-folders-using-simple-java/</link>
		<comments>http://techiedrill.com/2009/11/creating-folders-using-simple-java/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 07:21:29 +0000</pubDate>
		<dc:creator>karnamrajesh</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[simple]]></category>

		<guid isPermaLink="false">http://techiedrill.com/?p=446</guid>
		<description><![CDATA[import java.io.*;
class FileEx
{
 public static void main(String [] s) throws IOException
 {
// File f = new File(&#8221;xyz.txt&#8221;);
// f.delete();
 File f1 = new File(s[0]);
 f1.mkdir();
 File f2 = new File (f1,s[1]);
 f2.mkdir();
 File f3 = new File (f2,s[2]);
 f3.mkdir();
 if(f3.mkdir())
 {
 System.out.println(&#8221;Folder Created&#8230;.&#8221;);
 File ff = new File(f3,&#8221;akshatha.txt&#8221;);
 ff.createNewFile();
 }
 else
 {
 System.out.println(&#8221;folder already exists&#8230;&#8221;);
 }
 [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><em>import java.io.*;</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><em>class FileEx</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><em>{</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>public static void main(String [] s) throws IOException</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>{</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><em>//</em><span style="white-space: pre;"><em> </em></span><em>File f = new File(&#8221;xyz.txt&#8221;);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><em>//</em><span style="white-space: pre;"><em> </em></span><em>f.delete();</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>File f1 = new File(s[0]);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>f1.mkdir();</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>File f2 = new File (f1,s[1]);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>f2.mkdir();</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>File f3 = new File (f2,s[2]);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>f3.mkdir();</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>if(f3.mkdir())</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>{</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>System.out.println(&#8221;Folder Created&#8230;.&#8221;);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>File ff = new File(f3,&#8221;akshatha.txt&#8221;);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>ff.createNewFile();</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>}</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>else</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>{</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>System.out.println(&#8221;folder already exists&#8230;&#8221;);</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>}</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"><em> </em></span><em>}</em></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><em>}</em></div>
<p>It is quite easy to create folders using Java File concepts. Using java.io.file package we can create folders using mkdir(make directory) method. This can also handle folder already exists scenarios.</p>
<p>At the same time of creating folders it is also possible to create files of any extensions.</p>
<p>Try out the below sample code and explore things&#8230;</p>
<p><em>import java.io.*;</em></p>
<p><em>class FileEx</em></p>
<p><em>{</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>public static void main(String [] s) throws IOException</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>{</em></p>
<p><em>//</em><span style="white-space: pre;"><em> </em></span><em>File f = new File(&#8221;xyz.txt&#8221;);</em></p>
<p><em>//</em><span style="white-space: pre;"><em> </em></span><em>f.delete();</em></p>
<p><em><br />
</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>File f1 = new File(s[0]);</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>f1.mkdir();</em></p>
<p><em><br />
</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>File f2 = new File (f1,s[1]);</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>f2.mkdir();</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>File f3 = new File (f2,s[2]);</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>f3.mkdir();</em></p>
<p><em><br />
</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>if(f3.mkdir())</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>{</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>System.out.println(&#8221;Folder Created&#8230;.&#8221;);</em></p>
<p><em><br />
</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>File ff = new File(f3,&#8221;sample.txt&#8221;);</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>ff.createNewFile();</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>}</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>else</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>{</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>System.out.println(&#8221;folder already exists&#8230;&#8221;);</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>}</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>}</em></p>
<p><em>}</em></p>
]]></content:encoded>
			<wfw:commentRss>http://techiedrill.com/2009/11/creating-folders-using-simple-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
