PDT Dev2Dev - Copy Files the Eclipse way

From Eclipsepedia

Jump to: navigation, search

In case you want a convenient way to copy files the way Eclipse does, plus to have ability to copy directories, to track errors and have progress reported by monitor and several additional options, you are welcome:

new LocalFile(new File(source)).copy(new LocalFile(new File(destination)), EFS.NONE, monitor);

--Seva Lapsha 11:59, 6 November 2007 (EST)

Note that LocalFile has "discouraged access", and will result in a warning given the typical Java compiler settings within Eclipse. This can be avoided by adding an annotation to the function thusly:

@SuppressWarnings("restriction")

Alternatively, you can disable the restriction warning in Window->Preferences...->Java->Compiler->Errors/Warnings->Deprecated and restricted API

PS: Thank you very much.. quite handy.

--Mstorer3772.gmail.com 19:27, 23 March 2011 (UTC)