You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Flavio Pompermaier <po...@okkam.it> on 2015/06/29 12:39:11 UTC

FileSystem exists

Hi to all,

in my job I have to check if a directory exists and currently I have to
write:

Path myDir = new Path(...);
boolean exists = FileSystem.get(myDir.toUri()).exists(myDir);

Is there a better way to achieve this?

Best,
Flavio

Re: FileSystem exists

Posted by Flavio Pompermaier <po...@okkam.it>.
Ok..I don't like to repeat twice myDir but for the moment I can live with
it ;)

Thanks,
Flavio

On Mon, Jun 29, 2015 at 12:41 PM, Stephan Ewen <se...@apache.org> wrote:

> You can also do "myDir.getFileSystem().exists(myDir)", but I don't think
> there is a shorter way...
>
> On Mon, Jun 29, 2015 at 12:39 PM, Flavio Pompermaier <pompermaier@okkam.it
> > wrote:
>
>> Hi to all,
>>
>> in my job I have to check if a directory exists and currently I have to
>> write:
>>
>> Path myDir = new Path(...);
>> boolean exists = FileSystem.get(myDir.toUri()).exists(myDir);
>>
>> Is there a better way to achieve this?
>>
>> Best,
>> Flavio
>>
>
>

Re: FileSystem exists

Posted by Stephan Ewen <se...@apache.org>.
You can also do "myDir.getFileSystem().exists(myDir)", but I don't think
there is a shorter way...

On Mon, Jun 29, 2015 at 12:39 PM, Flavio Pompermaier <po...@okkam.it>
wrote:

> Hi to all,
>
> in my job I have to check if a directory exists and currently I have to
> write:
>
> Path myDir = new Path(...);
> boolean exists = FileSystem.get(myDir.toUri()).exists(myDir);
>
> Is there a better way to achieve this?
>
> Best,
> Flavio
>