# Empty Directory Upload Guide ## Problem webkitdirectory浏览器行为限制:**无法上传空目录** 浏览器只选择**文件**,空目录不会被包含在fileInput.files中。 ## Solutions ### Solution 1: Empty File Marker (Recommended) **Add `.keep` or `.gitkeep` in every empty directory:** ```bash # Before upload, add empty files in empty directories find /path/to/upload -type d -empty -exec touch {}/.keep \; # This ensures all directories will be uploaded ``` **Example structure:** ``` ExaSAN-DAS/ ├── ExaSAN-Carry-12/ │ ├── System_Code.bin │ └── Boot_Code.bin ├── EmptyFolder1/ │ └── .keep (0 bytes, ensures directory upload) └── EmptyFolder2/ ├── SubEmptyFolder/ │ └── .keep (nested empty directory) └── .keep ``` ### Solution 2: Manual Creation **Upload files first, then create empty directories:** ```bash # 1. Upload all files with webkitdirectory # 2. Find empty directories in source find /path/to/source -type d -empty > empty_dirs.txt # 3. Create in destination while read dir; do relative=${dir#/path/to/source/} mkdir -p "/Users/accusys/Downloads/accusys/$relative" done < empty_dirs.txt ``` ### Solution 3: Script Automation **Automated script for empty directory handling:** ```bash #!/bin/bash # prepare_upload.sh - Prepare directory for upload SOURCE_DIR="$1" echo "=== Preparing upload for $SOURCE_DIR ===" # Add .keep in all empty directories find "$SOURCE_DIR" -type d -empty | while read dir; do touch "$dir/.keep" echo "Added .keep in: $dir" done echo "=== Preparation complete ===" echo "Empty directories now have .keep files" echo "Ready for webkitdirectory upload" ``` **Usage:** ```bash # Prepare before upload bash scripts/prepare_upload.sh /path/to/ExaSAN-DAS # Then upload using webkitdirectory # All empty directories will be uploaded with .keep files ``` ## MarkBase Upload Service Status **Current Support:** - ✅ Empty files (0 bytes): `.localized`, `.keep`, `.gitkeep` - ✅ Subdirectory creation: Automatic `create_dir_all(parent)` - ✅ Multi-level paths: `subfolder/deeper/file.txt` - ❌ Empty directories: Browser limitation (use `.keep` workaround) ## Best Practice **For 290 files upload:** 1. **Prepare source directory:** ```bash bash scripts/prepare_upload.sh /path/to/AccuSys Downloads ``` 2. **Upload via webkitdirectory:** - Open https://download.accusys.ddns.net/upload - Select entire folder - All files + `.keep` files uploaded - Directory structure preserved 3. **Verify uploaded structure:** ```bash find /Users/accusys/Downloads/accusys -type d ``` ## Implementation Notes **MarkBase upload_unlimited API:** - Removed `file_size == 0` validation (server.rs:1145) - Allows empty files: `.localized`, `.keep`, `.DS_Store` - Automatic subdirectory creation: `create_dir_all(parent)` - SHA256 checksum for empty files: `e3b0c44298fc1c...` **Technical limitation:** - webkitdirectory是HTML5标准限制 - 无法通过服务器端修改绕过 - 只能通过`.keep`文件 workaround --- **Last Updated: 2026-06-09** **Version: 2.6 (Empty File + Empty Directory Support)**