<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-12168038.post658997333237299852..comments</id><updated>2010-04-29T14:06:31.272+05:30</updated><title type='text'>Comments on Vinod Singh: Copy, move and delete files using Java</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.vinodsingh.com/feeds/658997333237299852/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html'/><author><name>Vinod Singh</name><uri>http://www.blogger.com/profile/14429571106836951918</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12168038.post-5543768024702356059</id><published>2010-04-29T14:06:31.268+05:30</published><updated>2010-04-29T14:06:31.268+05:30</updated><title type='text'>The FileChannel.transferTo(..) may not copy all of...</title><content type='html'>The FileChannel.transferTo(..) may not copy all of the file bytes according to javadoc. You should then check the return value and repeat the call starting from the first non copied byte I think.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/5543768024702356059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/5543768024702356059'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html?showComment=1272530191268#c5543768024702356059' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html' ref='tag:blogger.com,1999:blog-12168038.post-658997333237299852' source='http://www.blogger.com/feeds/12168038/posts/default/658997333237299852' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12168038.post-2132003507056216192</id><published>2009-07-26T20:01:15.696+05:30</published><updated>2009-07-26T20:01:15.696+05:30</updated><title type='text'>File.delete does not throw an exception when it fa...</title><content type='html'>File.delete does not throw an exception when it fails, so making it very hard to know why the delete failed. With jdk7 (which has NIO2) then you can do f.toPath().delete() and it will throw an IOException with the reason why the delete failed.&lt;br /&gt;&lt;br /&gt;For moving files when f.toPath().moveTo(...) can be used. The moveTo method has options to say if an existing file should be replaced or not or if you want the operation to be atomic.&lt;br /&gt;&lt;br /&gt;For copying files there is f.toPath().copyTo(...). This knows how to copy file permissions and other meta data. It copies a single file or directory. To copy a directory tree you use it with Files.walkFileTree which knows how to handle symbolic links. There are simple examples in the javadoc, and more complete sample code in the samples directory.&lt;br /&gt;&lt;br /&gt;I haven&amp;#39;t used Commons IO but it may have some issues because it uses java.io.File.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/2132003507056216192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/2132003507056216192'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html?showComment=1248618675696#c2132003507056216192' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html' ref='tag:blogger.com,1999:blog-12168038.post-658997333237299852' source='http://www.blogger.com/feeds/12168038/posts/default/658997333237299852' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12168038.post-2953599727717086553</id><published>2009-06-14T17:42:24.431+05:30</published><updated>2009-06-14T17:42:24.431+05:30</updated><title type='text'>To correct myself, I found the line iterator. On a...</title><content type='html'>To correct myself, I found the line iterator. On a somewhat different topic, it would be nice if these apache util libraries were updated to modern coding practices. Commons IO is very Java 1.4-ish. The lack of generics usage means lots of ugly casts in the code. I&amp;#39;ll probably need to write a wrapper layer for some of the methods to keep the code clean and tight.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/2953599727717086553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/2953599727717086553'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html?showComment=1244981544431#c2953599727717086553' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html' ref='tag:blogger.com,1999:blog-12168038.post-658997333237299852' source='http://www.blogger.com/feeds/12168038/posts/default/658997333237299852' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12168038.post-6887604254366812803</id><published>2009-06-14T17:06:13.648+05:30</published><updated>2009-06-14T17:06:13.648+05:30</updated><title type='text'>Commons IO is a nice set of utilities but it appea...</title><content type='html'>Commons IO is a nice set of utilities but it appears to have it&amp;#39;s own issues. After reading your comment I investigated using it on a project with some existing file utilities. Within 10 minutes I ran into two problems with the library. First, there is no way to iterate over lines in a file without reading them all into memory. Obviously this is not good when doing line-based processing of large files. Second, the file filters implement both the FileFilter and FilenameFilter interfaces. This requires a cast when using them with the File.listFiles() method. It&amp;#39;s a minor issue, but it makes me curious about what other design warts I&amp;#39;ll find as dig deeper. As always, caveat emptor.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/6887604254366812803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/6887604254366812803'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html?showComment=1244979373648#c6887604254366812803' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html' ref='tag:blogger.com,1999:blog-12168038.post-658997333237299852' source='http://www.blogger.com/feeds/12168038/posts/default/658997333237299852' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12168038.post-5386552011317048235</id><published>2009-06-14T16:15:58.863+05:30</published><updated>2009-06-14T16:15:58.863+05:30</updated><title type='text'>Even though it's nice to have simple one liners fo...</title><content type='html'>Even though it&amp;#39;s nice to have simple one liners for common IO operations, I would strongly suggest the use of Commons IO (http://commons.apache.org/io/) Apache project.&lt;br /&gt;&lt;br /&gt;The methods and functionality provided in the Commons IO is implemented by experienced coders and they have all been tested in numerous large open source and commercial projects. This is particularly important since the Java IO facilities are subpart at best and useless at worst. Most methods return a boolean value for their result and they have many exceptional cases that need to be considered.&lt;br /&gt;&lt;br /&gt;Hopefully the NIO2 changes that will be included in Java 7 will remedy the sorry state of file IO in the JVM.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/5386552011317048235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/5386552011317048235'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html?showComment=1244976358863#c5386552011317048235' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html' ref='tag:blogger.com,1999:blog-12168038.post-658997333237299852' source='http://www.blogger.com/feeds/12168038/posts/default/658997333237299852' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-12168038.post-1294129107770868829</id><published>2009-06-12T20:22:33.764+05:30</published><updated>2009-06-12T20:22:33.764+05:30</updated><title type='text'>One remark: renameTo does not work if your target ...</title><content type='html'>One remark: renameTo does not work if your target path is on a different filesystem. It will simply return false.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/1294129107770868829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12168038/658997333237299852/comments/default/1294129107770868829'/><link rel='alternate' type='text/html' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html?showComment=1244818353764#c1294129107770868829' title=''/><author><name>David</name><uri>http://www.jroller.com/ethdsy</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.vinodsingh.com/2009/06/copy-move-and-delete-files-using-java.html' ref='tag:blogger.com,1999:blog-12168038.post-658997333237299852' source='http://www.blogger.com/feeds/12168038/posts/default/658997333237299852' type='text/html'/></entry></feed>