// Name: Create Subfolder // Description: Select a folder, then create a new subfolder inside it. // Author: kenNash // GitHub: kenNash import "@johnlindquist/kit" const parentFolder = await selectFolder("Select a parent folder") if (!parentFolder) exit() const folderName = await arg({ placeholder: "Enter new folder name", strict: false, validate: async (input: string) => { const name = input.trim() if (!name) return "Folder name cannot be empty" if (/[\\/:*?"<>|]/.test(name)) return "Folder name contains invalid characters" const fullPath = path.join(parentFolder, name) if (await pathExists(fullPath)) return "A folder with this name already exists" return true }, }) const newFolderPath = path.join(parentFolder, folderName.trim()) await ensureDir(newFolderPath) await notify(`Created folder: ${newFolderPath}`) await revealInFinder(newFolderPath)