@Override
    public PathAttributes find(final Path file, final ListProgressListener listener) throws BackgroundException {
        if(file.isRoot()) {
            return PathAttributes.EMPTY;
        }
        final SMBSession.DiskShareWrapper share = session.openShare(file);
        try {
            if(new SMBPathContainerService(session).isContainer(file)) {
                final ShareInfo shareInformation = share.get().getShareInformation();
                final PathAttributes attributes = new PathAttributes();
                final long used = shareInformation.getTotalSpace() - shareInformation.getFreeSpace();
                attributes.setSize(used);
                attributes.setQuota(new Quota.Space(used, shareInformation.getFreeSpace()));
                return attributes;
            }
            else {
                final FileAllInformation fileInformation = share.get().getFileInformation(new SMBPathContainerService(session).getKey(file));
                if(file.isDirectory() && !fileInformation.getStandardInformation().isDirectory()) {
                    throw new NotfoundException(String.format("File %s found but type is not directory", file.getName()));
                }
                else if(file.isFile() && fileInformation.getStandardInformation().isDirectory()) {
                    throw new NotfoundException(String.format("File %s found but type is not file", file.getName()));
                }
                return this.toAttributes(fileInformation);
            }
        }
        catch(SMBRuntimeException e) {
            throw new SMBExceptionMappingService().map("Failure to read attributes of {0}", e, file);
        }
        finally {
            session.releaseShare(share);
        }
    }
@Test
    public void testFindFile() throws Exception {
        final Path test = new SMBTouchFeature(session).touch(new Path(new DefaultHomeFinderService(session).find(),
                new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus());
        final SMBAttributesFinderFeature f = new SMBAttributesFinderFeature(session);
        final PathAttributes attributes = f.find(test);
        assertEquals(0L, attributes.getSize());
        assertNotEquals(-1L, attributes.getModificationDate());
        // Test wrong type
        assertThrows(NotfoundException.class, () -> f.find(new Path(test.getAbsolute(), EnumSet.of(Path.Type.directory))));
        new SMBDeleteFeature(session).delete(Collections.singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }