diff --git a/src/pages/utilities/Renamer.tsx b/src/pages/utilities/Renamer.tsx index 445aaf029..22b783fab 100644 --- a/src/pages/utilities/Renamer.tsx +++ b/src/pages/utilities/Renamer.tsx @@ -15,7 +15,7 @@ import { } from '@mdi/js'; import { Icon } from '@mdi/react'; import { produce } from 'immer'; -import { filter, find, isEqual, map } from 'lodash'; +import { chunk, filter, find, isEqual, map } from 'lodash'; import { useImmer } from 'use-immer'; import { useDebounceValue, useToggle } from 'usehooks-ts'; @@ -397,6 +397,19 @@ const Renamer = () => { [renamer], ); + const handleRename = useEventCallback(() => { + // Split the files into chunks of 1000 to avoid API errors + chunk(addedFiles, 1000).forEach((files) => { + relocateFiles({ + configName: selectedConfig.Name, + move: moveFiles, + rename: true, + deleteEmptyDirectories: true, + FileIDs: files.map(file => file.ID), + }); + }); + }); + return (