Skip to content
Back to skills

Cloud Storage Paths

ASecurity

Cross-platform cloud storage path resolution — OneDrive, iCloud, Dropbox path discovery and normalization

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
developmentjavascriptgojavadebugging

Works with

  • vscode

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 12, 2026

npx -y skills add aibot88/sec_skill_store --skill cloud-storage-paths --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cloud Storage Paths?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cloud Storage Paths
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aibot88-cloud-storage-paths/badge)](https://www.skillsdirectory.com/skills/aibot88-cloud-storage-paths)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
type: skill
lifecycle: stable
inheritance: inheritable
name: cloud-storage-paths
description: Cross-platform cloud storage path resolution — OneDrive, iCloud, Dropbox path discovery and normalization
tier: standard
applyTo: '**/*cloud*,**/*storage*,**/*paths*'
currency: 2026-04-30
lastReviewed: 2026-04-30
---

# Cloud Storage Paths

**Category**: Cross-Platform
**Time Saved**: 1-2 hours debugging path resolution
**Battle-tested**: Yes — iCloud, OneDrive, Dropbox variants

---

## The Problem

Your app needs to find the user's iCloud Drive (or OneDrive, Dropbox, Google Drive). You hardcode `~/iCloudDrive` and it works on your machine. Users report "folder not found" errors.

## Why It Happens

Cloud storage paths vary by:

1. **Provider** — Each has different naming conventions
2. **OS** — Same provider has different paths per OS
3. **Account type** — Personal vs Business often differ
4. **Installation method** — App Store vs direct download
5. **Version** — Paths change between app versions

## The Rule

**Use a candidate-list approach. Check all known paths in priority order. Return first that exists.**

## Path Variants by Provider

### iCloud Drive

| Platform | Possible Paths |
|----------|---------------|
| macOS | `~/Library/Mobile Documents/com~apple~CloudDocs/` |
| Windows | `%USERPROFILE%\iCloudDrive\` |
| Windows | `%USERPROFILE%\iCloud Drive\` (space) |
| Windows | `%USERPROFILE%\iCloud~com~apple~CloudDocs\` |

### OneDrive

| Account Type | Windows Path |
|--------------|-------------|
| Personal | `%USERPROFILE%\OneDrive\` |
| Business | `%USERPROFILE%\OneDrive - CompanyName\` |
| Education | `%USERPROFILE%\OneDrive - SchoolName\` |

macOS: `~/Library/CloudStorage/OneDrive-Personal/` or `~/Library/CloudStorage/OneDrive-CompanyName/`

### Dropbox

| Platform | Possible Paths |
|----------|---------------|
| Windows | `%USERPROFILE%\Dropbox\` |
| Windows | `%APPDATA%\Dropbox\` (older) |
| macOS | `~/Dropbox/` |
| macOS | `~/Library/CloudStorage/Dropbox/` (newer) |

### Google Drive

| Platform | Possible Paths |
|----------|---------------|
| Windows | `%USERPROFILE%\Google Drive\` |
| Windows | `G:\My Drive\` (mapped drive) |
| macOS | `~/Google Drive/` |
| macOS | `~/Library/CloudStorage/GoogleDrive-email/` |

## Implementation Pattern

```javascript
const fs = require('fs');
const path = require('path');
const os = require('os');

function findCloudStorage(provider) {
  const home = os.homedir();
  const candidates = getCandidates(provider, home);
  
  for (const candidate of candidates) {
    if (fs.existsSync(candidate)) {
      return candidate;
    }
  }
  
  return null; // Not found
}

function getCandidates(provider, home) {
  const isWindows = process.platform === 'win32';
  
  switch (provider) {
    case 'icloud':
      return isWindows ? [
        path.join(home, 'iCloudDrive'),
        path.join(home, 'iCloud Drive'),
        path.join(home, 'iCloud~com~apple~CloudDocs'),
      ] : [
        path.join(home, 'Library/Mobile Documents/com~apple~CloudDocs'),
      ];
      
    case 'onedrive':
      return isWindows ? [
        path.join(home, 'OneDrive'),
        // Scan for business accounts
        ...findOneDriveBusinessPaths(home),
      ] : [
        path.join(home, 'Library/CloudStorage/OneDrive-Personal'),
        ...findOneDriveBusinessPaths(home),
      ];
      
    case 'dropbox':
      return isWindows ? [
        path.join(home, 'Dropbox'),
        path.join(process.env.APPDATA || '', 'Dropbox'),
      ] : [
        path.join(home, 'Dropbox'),
        path.join(home, 'Library/CloudStorage/Dropbox'),
      ];
      
    default:
      return [];
  }
}

function findOneDriveBusinessPaths(home) {
  // Scan for "OneDrive - *" folders
  const paths = [];
  try {
    const entries = fs.readdirSync(home);
    for (const entry of entries) {
      if (entry.startsWith('OneDrive - ')) {
        paths.push(path.join(home, entry));
      }
    }
  } catch { /* ignore */ }
  return paths;
}
```

## Environment Variable Hints

Some providers set environment variables:

```javascript
// OneDrive often sets these
process.env.OneDrive           // Personal
process.env.OneDriveCommercial // Business

// Use if available, fall back to scanning
const onedrive = process.env.OneDrive || findCloudStorage('onedrive');
```

## Verification Checklist

- [ ] Never hardcode a single cloud storage path
- [ ] Check all known variants for the provider
- [ ] Handle "not installed" case gracefully
- [ ] Test on multiple machines with different setups
- [ ] Log which path was found for debugging

## Common Symptoms

- "Works on my machine" with cloud storage
- "Folder not found" on user machines
- Different paths in bug reports

## Related Skills

- `vscode-cross-platform-paths` — VS Code config paths
- `line-ending-parsing` — Cross-platform file handling

Files in this skill

  • SKILL.md4.8 KB
  • source.json639 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.