Productivity Tutorial15 min read

File Management Automation with Moltbot

Let Moltbot organize your digital life. Automatically sort downloads, find files with natural language, clean duplicates, and manage your file system through simple chat commands.

What You Can Do

Moltbot can access your local file system to perform powerful organization tasks. Here are the most popular automations:

Download Organizer

Auto-sort Downloads folder by file type and date

Natural Language Search

Find files by describing their content

Duplicate Cleaner

Find and remove duplicate files automatically

Smart Archiving

Auto-archive old files to free up space

Chat Commands

Control your files through natural conversation. Here are examples of what you can say:

๐Ÿ‘ค

You

Organize my Downloads folder by file type

๐Ÿฆž

Moltbot

Done! I've organized your Downloads folder:

  • ๐Ÿ“ Documents/ - 45 PDFs, 12 Word docs moved
  • ๐Ÿ“ Images/ - 23 photos, 8 screenshots moved
  • ๐Ÿ“ Archives/ - 5 zip files moved
  • ๐Ÿ—‘๏ธ Temp/ - 12 temporary files deleted
๐Ÿ‘ค

You

Find that presentation about Q4 revenue I downloaded last week

๐Ÿฆž

Moltbot

Found it! ๐Ÿ“Š Q4_Revenue_Report_2025.pptx

Location: ~/Downloads/Documents/
Size: 4.2 MB | Modified: Jan 20, 2026

๐Ÿ‘ค

You

Clean up duplicate photos in my Pictures folder

๐Ÿฆž

Moltbot

Duplicate scan complete! ๐Ÿ”

  • ๐Ÿ“Š 127 duplicate groups found
  • ๐Ÿ’พ 2.3 GB can be freed
  • โš ๏ธ Review recommended for 12 items

Reply "delete duplicates" to remove them, or "show me" to review first.

Implementation Guide

1. Download Organizer Skill

// skills/download-organizer.js
module.exports = {
  name: 'download-organizer',
  
  async run({ config, apis }) {
    const downloadsPath = config.downloadsPath || '~/Downloads';
    const files = await apis.fs.listFiles(downloadsPath);
    
    const categories = {
      images: ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg'],
      documents: ['.pdf', '.doc', '.docx', '.txt', '.rtf'],
      archives: ['.zip', '.rar', '.7z', '.tar', '.gz'],
      videos: ['.mp4', '.mov', '.avi', '.mkv'],
      audio: ['.mp3', '.wav', '.aac', '.flac'],
      code: ['.js', '.ts', '.py', '.html', '.css', '.json']
    };
    
    for (const file of files) {
      const ext = file.name.slice(file.name.lastIndexOf('.')).toLowerCase();
      
      for (const [category, extensions] of Object.entries(categories)) {
        if (extensions.includes(ext)) {
          const targetDir = `${downloadsPath}/${category}`;
          await apis.fs.ensureDir(targetDir);
          await apis.fs.move(file.path, `${targetDir}/${file.name}`);
          break;
        }
      }
    }
    
    return { organized: files.length };
  }
};

2. Natural Language File Search

// skills/file-search.js
module.exports = {
  name: 'file-search',
  
  async run({ query, apis }) {
    // Use AI to understand the query
    const searchParams = await apis.ai.extract({
      prompt: `Extract search parameters from: "${query}"
        Return JSON with: fileType, keywords, timeRange, location`
    });
    
    // Search file system
    const files = await apis.fs.search({
      pattern: searchParams.keywords,
      extensions: searchParams.fileType,
      modifiedAfter: searchParams.timeRange?.start,
      modifiedBefore: searchParams.timeRange?.end,
      path: searchParams.location
    });
    
    // Read content of text files for context
    const results = [];
    for (const file of files.slice(0, 10)) {
      if (file.isText) {
        const content = await apis.fs.read(file.path, 'utf8');
        const relevance = await apis.ai.scoreRelevance(query, content);
        results.push({ ...file, relevance });
      } else {
        results.push(file);
      }
    }
    
    return results.sort((a, b) => (b.relevance || 0) - (a.relevance || 0));
  }
};

3. Duplicate File Cleaner

// skills/duplicate-cleaner.js
const crypto = require('crypto');

module.exports = {
  name: 'duplicate-cleaner',
  
  async run({ config, apis }) {
    const scanPath = config.scanPath || '~/Downloads';
    const files = await apis.fs.listFiles(scanPath, { recursive: true });
    
    // Group by size first (optimization)
    const bySize = {};
    for (const file of files) {
      if (!bySize[file.size]) bySize[file.size] = [];
      bySize[file.size].push(file);
    }
    
    // Hash potential duplicates
    const duplicates = [];
    for (const [size, sizeGroup] of Object.entries(bySize)) {
      if (sizeGroup.length < 2) continue;
      
      const hashes = {};
      for (const file of sizeGroup) {
        const hash = await this.hashFile(file.path);
        if (hashes[hash]) {
          duplicates.push([file, hashes[hash]]);
        } else {
          hashes[hash] = file;
        }
      }
    }
    
    return {
      duplicates,
      spaceToRecover: duplicates.reduce((sum, [f1, f2]) => sum + f1.size, 0)
    };
  },
  
  async hashFile(path) {
    const content = await apis.fs.read(path);
    return crypto.createHash('md5').update(content).digest('hex');
  }
};

Security Considerations

File system access is powerful but requires careful security setup:

  • Run Moltbot in a sandboxed environment for file operations
  • Define allowed directories in configuration - never give full system access
  • Use confirmation prompts for destructive operations (delete, move)
  • Regular backups before enabling auto-cleanup features

Organize Your Digital Life

Never lose a file again. Let Moltbot handle the organization while you focus on what matters.