This commit is contained in:
2026-07-17 19:08:42 +09:00
commit da27a80a3a
15 changed files with 2480 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import { Plugin } from "obsidian";
export default class PAUL extends Plugin {
async onload() {
// Command 추가
this.addCommand({
id: 'FileToFolder',
name: 'File to Folder',
callback: () => {
this.fileToFolder();
},
});
}
// Actual functions
async fileToFolder() {
const activeFile = this.app.workspace.getActiveFile();
if (!activeFile) {
new Notice('No file is open.');
return;
}
const fileBaseName = activeFile.basename;
const fileExtension = activeFile.extension;
const folderPath = `${activeFile.parent.path}/${fileBaseName}`;
try {
// Create the folder
await this.app.vault.createFolder(folderPath);
// Move the file into the folder
await this.app.vault.rename(activeFile, `${folderPath}/${fileBaseName}.${fileExtension}`);
new Notice('File moved to new folder successfully.');
} catch (error) {
console.error("Error in FileToFolder plugin:", error);
new Notice('An error occurred.');
}
}
}