Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: AW: AW: [geclipse-dev] File Transfer

Hi Pod,

> This EFS is new and seems interesting. Actually I use this piece of code
>
>   URI uri = new
> URI("gsiftp://aliserv6.ct.infn.it:2811/dpm/ct.infn.it/home/geclipsetutor
>/foofoo/"); IFileStore fs = EFS.getStore( uri );
> 	        System.out.println(fs.getFileSystem().canWrite());
> 	        IFileSystem fileSystem = EFS.getLocalFileSystem();
> 	        IFileStore homeDir =
> fileSystem.getStore(URI.create("/home/pod/files")); homeDir.copy(fs,
> EFS.SHALLOW | EFS.OVERWRITE, null);
> 	        IFileInfo info = fs.fetchInfo();
...

> With that code I should fetch all files in foofoo to my local dir?  This

no, you are just fetching the metadata there (modification date, size, etc, 
see org.eclipse.core.filesystem.IFileInfo)

Take a look at the javadoc for the   childStores(), copy() and getChild() 
methods of   org.eclipse.core.filesystem.IFileStore

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/filesystem/IFileStore.html

On files you can also use openInputStream(), openOutputStream() to 
read/write

In particular copy() of a folder does what you want:

	 * The {@link EFS#SHALLOW} option flag indicates how
	 * this method deals with copying of directories. If the 
<code>SHALLOW</code> 
	 * flag is present, then a directory will be copied but the files and 
directories
	 * within it will not.  When this flag is not present, all child 
directories and files
	 * of a directory are copied recursively.

Cheers, Ariel


Back to the top