<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[JavaRanch: Latest posts for the topic "File Renaming while getting copied."]]></title>
		<link>http://www.coderanch.com/forums/t/38/Streams/File-Renaming-while-getting-copied</link>
		<description><![CDATA[Latest messages posted in the topic "File Renaming while getting copied."]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>File Renaming while getting copied.</title>
				<description><![CDATA[Hi Guys,<br /> <br /> I need an approach for my requirement, any pointers will be helpful.<br /> <br /> Requirement - I have a file (size of 20 gb) I will be copying it to a mapped drive, but while copying I have to keep my file name with an extension as ".wait" and then when it gets fully copied I have to rename it to the proper extension say ".exn".<br /> <br /> There will be a large number of files coming in and I am looking for a approach which wont affect the performance.<br /> <br /> P.S: The requirement is not LOCKING the file, I just have to rename it until i finish copying.<br /> <br /> Thanks in advance.<br /> <br /> <br /> <br /> ... <img src="http://www.coderanch.com/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif" /> Happy Developing]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/1995122</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/1995122</link>
				<pubDate><![CDATA[Thu, Jun 4 2009 14:07:44 MDT]]></pubDate>
				<author><![CDATA[Robin John]]></author>
			</item>
			<item>
				<title>FILE RENAMING WHILE GETTING COPIED.</title>
				<description><![CDATA[Please <a class="snap_shots" href="http://faq.javaranch.com/view?KeepItDown" target="_new" rel="nofollow">read this</a>.]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/1995128</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/1995128</link>
				<pubDate><![CDATA[Thu, Jun 4 2009 14:12:28 MDT]]></pubDate>
				<author><![CDATA[Bear Bibeault]]></author>
			</item>
			<item>
				<title>FILE RENAMING WHILE GETTING COPIED.</title>
				<description><![CDATA[<blockquote>
			<div>
				<cite>Bear Bibeault wrote:</cite>Please <a class="snap_shots" href="http://faq.javaranch.com/view?KeepItDown" target="_new" rel="nofollow">read this</a>.</div>
		</blockquote><br /> <br /> Hi Bear, sorry. read that but how to change the subject now : D]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/1995141</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/1995141</link>
				<pubDate><![CDATA[Thu, Jun 4 2009 14:35:18 MDT]]></pubDate>
				<author><![CDATA[Robin John]]></author>
			</item>
			<item>
				<title>FILE RENAMING WHILE GETTING COPIED.</title>
				<description><![CDATA[<blockquote>
			<div>
				<cite>Robin John wrote:</cite>Hi Bear, sorry. read that but how to change the subject now : D</div>
		</blockquote><br /> <br /> You don't see an Edit button on the post?<br /> <br /> Anyway, I don't understand the question. I assume it's the target that these requirements refer to, i.e. the file you are copying the data to? If so, then just copy the data to a file whose name is "blabla.wait" and when you're finished copying, rename it appropriately.<br /> ]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/1995150</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/1995150</link>
				<pubDate><![CDATA[Thu, Jun 4 2009 14:50:58 MDT]]></pubDate>
				<author><![CDATA[Paul Clapham]]></author>
			</item>
			<item>
				<title>File Renaming while getting copied.</title>
				<description><![CDATA[aaaah... got it.. now I know if you press edit on the comment box you can also change the subject... may be we should have one edit button beside the subject line... just an opinion : )<br /> <br /> Okay for the question.. <br /> <br /> The problem is when I copy the file entirely and put it in that folder it will be picked up by another application and that will check if the extension is .exn and if not it will be purged. The application checks the folder for every 0.3 seconds if the file is modified or not and then picks it up.<br /> <br /> so I thought of renaming the file just before the end of file is reached, can this be done ? and if I go for your approach will 0.3 seconds will be enough to rename the file after its copied "everytime".<br /> <br /> I know this may sound obvious but just wanted to confirm.<br /> <br /> Regards.]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/1995892</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/1995892</link>
				<pubDate><![CDATA[Fri, Jun 5 2009 15:26:47 MDT]]></pubDate>
				<author><![CDATA[Robin John]]></author>
			</item>
			<item>
				<title>File Renaming while getting copied.</title>
				<description><![CDATA[I must be misunderstanding your requirements. Now you seem to be saying that the receiving application will purge files whose extension isn't .exn, every 0.3 seconds. You can't copy a 20MB file anywhere in 0.3 seconds. So this doesn't make any sense to me.<br /> <br /> And assuming that wasn't what you meant to say, I don't understand why you want to rename the file before you finish copying it. That just exposes you to the risk that the receiving application will do something with it before the copying is complete.<br /> <br /> You can certainly rename a file in under 0.3 seconds but I don't understand why that's an issue at all. If the thing works the way I expect it does (as opposed to the way you're describing it), then the receiving application will see your renamed file within 0.3 seconds of your renaming it. Assuming it does its sweep every 0.3 seconds, that is.]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/1995896</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/1995896</link>
				<pubDate><![CDATA[Fri, Jun 5 2009 15:33:24 MDT]]></pubDate>
				<author><![CDATA[Paul Clapham]]></author>
			</item>
			<item>
				<title>File Renaming while getting copied.</title>
				<description><![CDATA[<br /> This is an interesting problem. I may have come across it a time or two.<br /> <br /> Facts:<br /> 1. When large files are copied, OS will create the node for that file before completing the copying and writing EOF. Other applications can see and read that file. They can not write, rename, move or delete that file.<br /> 2. In terms of speed, rename is faster than move. And move is faster than copy.<br /> 3. Rename CAN NOT occur until EOF is written, that is, until file is completed copying.<br /> 4. I am assuming the file in question and the application/scripts are all on a local system. FTP files have slightly different facts.<br /> <br /> <b>Is the question here:<br /> <br /> How can I ensure that the receiving application does NOT see the file until it is completed copying ?</b><br /> <br /> <br /> Randi<br /> ]]></description>
				<guid isPermaLink="true">http://www.coderanch.com/forums/posts/preList/448361/2015450</guid>
				<link>http://www.coderanch.com/forums/posts/preList/448361/2015450</link>
				<pubDate><![CDATA[Sat, Jul 4 2009 10:02:56 MDT]]></pubDate>
				<author><![CDATA[Randi Randwa]]></author>
			</item>
	</channel>
</rss>
