diff --git a/app/src/components/FileBrowser.js b/app/src/components/FileBrowser.js
index 5111f5e2..b54fe720 100644
--- a/app/src/components/FileBrowser.js
+++ b/app/src/components/FileBrowser.js
@@ -61,14 +61,11 @@ function Folder({folder, onFolderClick, sortData, selectedPaths, onFileClick, on
= 0} onChange={() => onSelect(folder['path'])}/>
- onFolderClick(path)} className='file-path' disabled={is_empty}>
+ onFolderClick(path)} className='file-path' colSpan={2} disabled={is_empty}>
{depthIndentation(pathWithNoTrailingSlash)}
{is_empty ? : }
{name}
-
- {size > 0 && humanFileSize(size)}
-
;
if (children) {
// Folder has children, recursively display them.
diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py
index 332df9f2..4e6742e4 100644
--- a/wrolpi/files/lib.py
+++ b/wrolpi/files/lib.py
@@ -77,30 +77,14 @@ def get_file_dict(file: str) -> Dict:
return _get_file_dict(media_directory / file)
-def get_directory_size(directory: pathlib.Path) -> int:
- """Returns the size of all the files in the specified directory in bytes using the `du` command."""
- # Execute the 'du' command to get the total size of the directory
- result = subprocess.run(['du', '-sb', directory], capture_output=True, check=True, text=True)
- # The output is in the format "size\t directory\n", so split by tab and take the first element
- size = int(result.stdout.split("\t")[0])
- return size - 4096 # Remove size of directory.
-
-
@cachetools.func.ttl_cache(10_000, 30.0)
def _get_directory_dict(directory: pathlib.Path,
directories_cache: str, # Used to cache by requested directories.
) -> Dict:
media_directory = get_media_directory()
- try:
- directory_size = get_directory_size(directory)
- except Exception as e:
- logger.error('Failed to get directory size', e)
- directory_size = 0
-
return dict(
path=f'{directory.relative_to(media_directory)}/',
is_empty=not next(directory.iterdir(), False),
- size=directory_size,
)
diff --git a/wrolpi/files/test/test_api.py b/wrolpi/files/test/test_api.py
index c2f04c2a..3610ad99 100644
--- a/wrolpi/files/test/test_api.py
+++ b/wrolpi/files/test/test_api.py
@@ -587,22 +587,3 @@ async def test_delete_directory_recursive(test_session, test_directory, make_fil
empty = test_session.query(FileGroup).one()
assert empty.primary_path.name == 'empty'
-
-@pytest.mark.asyncio
-async def test_get_directory_size(test_session, test_directory, make_files_structure, test_async_client):
- make_files_structure({
- 'foo/one': 'one contents',
- 'foo/two': 'two contents',
- 'bar/one': 'baz contents',
- })
- # Make empty directory.
- (test_directory / 'baz').mkdir()
-
- request, response = await test_async_client.post('/api/files/refresh')
- assert response.status_code == HTTPStatus.NO_CONTENT
-
- request, response = await test_async_client.post('/api/files', content=json.dumps({'directories': []}))
- assert response.status_code == HTTPStatus.OK
- assert response.json['files']['foo/']['size'] == 24
- assert response.json['files']['bar/']['size'] == 12
- assert response.json['files']['baz/']['size'] == 0