This is a TypeScript script (using Node.js APIs) that organizes your files and folders automatically based on file type.
- Install Node.js and pnpm (preferred) or npm.
- Clone the repository or download the script file.
- Install dependencies by running
pnpm install
(preferred) ornpm install
. I will usepnpm
in the following tutorial
To use the script, run the following command:
tsm index.ts [folderPath] [--recursive]
or
pnpm start [folderPath] -- [--recursive]
--recursive
(optional): Organize files recursively in folders.folderPath
(optional): Specify the path to the folder to organize. If not provided, the script will try to organize files in the/Users/{username}/Desktop/test/
directory.
If you have ts-node
installed globally, you can also run the file with:
./index.ts
tsm index.ts ~/Documents --recursive
or
pnpm start ~/Documents -- --recursive
This will organize files in the Documents
folder and all its subfolders based on file type.
The script uses Node.js file APIs to search for files and move them to the appropriate folders based on their file type.
This script is licensed under the MIT License. See LICENSE for more information.