# Quick Guide: Migrate to /opt/migration/ Structure

## Why Change?

**Current:** `/var/www/html/wordpress6/wordpress/EP/migration/`  
**Problems:**
- Too deeply nested
- Mixes web content with admin tools
- Not following Linux standards
- Hard to find and manage

**New:** `/opt/migration/`  
**Benefits:**
- ✅ Standard Linux FHS structure
- ✅ Not web-accessible (more secure)
- ✅ Clean and organized
- ✅ Easy to find: `cd /opt/migration/scripts`

## Quick Migration (3 Steps)

### Step 1: Run Migration Script

```bash
cd /var/www/html/wordpress6/wordpress/EP/migration
sudo ./migrate-to-opt-structure.sh
```

This will:
- Create `/opt/migration/{scripts,docs,logs,templates}`
- Move all files to appropriate locations
- Update references in scripts and docs
- Create backward-compatibility symlink

### Step 2: Verify

```bash
# Check new structure
ls -la /opt/migration/

# Test a script
/opt/migration/scripts/inventory-applications.sh
```

### Step 3: Update Your Workflow

**Old way:**
```bash
cd /var/www/html/wordpress6/wordpress/EP/migration
./prepare-new-server.sh
```

**New way:**
```bash
cd /opt/migration/scripts
./prepare-new-server.sh
```

Or use full path:
```bash
/opt/migration/scripts/prepare-new-server.sh
```

## New Structure

```
/opt/migration/
├── scripts/          # All .sh files
├── docs/             # All .md files  
├── logs/             # Log files
└── templates/        # Config templates
```

## Copying to New Server

After migration, copy to new server:

```bash
# From old server
rsync -avz /opt/migration/ root@vps2.scala4.com:/opt/migration/
```

The new server's `prepare-new-server.sh` already creates this structure!

## Backward Compatibility

The migration script creates a symlink, so old paths may still work:
```bash
# This will work (via symlink)
cd /var/www/html/wordpress6/wordpress/EP/migration
```

But it's better to use the new path:
```bash
cd /opt/migration/scripts
```

---

**Ready?** Run: `sudo ./migrate-to-opt-structure.sh`



