// Name: Create Subfolder // Description: Creates a subfolder of the selected folder. // Author: kenNash import "@johnlindquist/kit" const parentFolder = await selectFolder("Select the parent folder") const subfolderName = (await arg({ placeholder: "Enter new subfolder name", strict: false, validate: input => input.trim().length > 0 || "Folder name cannot be empty", })).trim() const newSubfolderPath = path.join(parentFolder, subfolderName) await ensureDir(newSubfolderPath) await notify(`Created: ${newSubfolderPath}`) await revealInFinder(newSubfolderPath)// Name: Create Subfolder in Selected Folder // Description: Creates a subfolder inside the currently selected Finder folder. // Author: kenNash // GitHub: kenNash import "@johnlindquist/kit" let parent = "" try { parent = await getSelectedDir() } catch {} if (!parent || !(await pathExists(parent)) || !(await isDir(parent))) { parent = await selectFolder("Select the parent folder") } setDescription(parent) const folderName = await arg({ placeholder: "Enter new subfolder name", validate: async (input: string) => { const name = input.trim() if (!name) return "Folder name cannot be empty" if (/[\/:*?"<>|]/.test(name)) return `Folder name cannot contain / : * ? " < > |` return true }, enter: "Create Subfolder", }) const newFolderPath = path.join(parent, folderName.trim()) await ensureDir(newFolderPath) await notify(`Created: ${folderName}`) await revealInFinder(newFolderPath)