Overview
GDrive Ingest automatically categorizes and organizes files based on their type and metadata. Music files get special treatment with artist/album/year folder structures and embedded cover art extraction.
File Categories
Files are automatically sorted into these categories:
Music
Videos
Images
Documents
Archives
Others
Extensions:
.mp3, .flac, .m4a, .wav, .aac, .ogg, .opus, .wmaOrganization: Music/
βββ Artist Name/
βββ Album Title (Year)/
βββ 01 - Track.mp3
βββ 02 - Track.mp3
βββ cover.jpg
See Music Files for details. Extensions:
.mp4, .mkv, .avi, .mov, .wmv, .flv, .webm, .m4vOrganization: Videos/
βββ movie1.mp4
βββ movie2.mkv
βββ clip.avi
Extensions:
.jpg, .jpeg, .png, .gif, .webp, .svg, .bmp, .icoOrganization: Images/
βββ photo1.jpg
βββ screenshot.png
βββ graphic.svg
Extensions:
.pdf, .txt, .doc, .docx, .xls, .xlsx, .ppt, .pptxOrganization: Docs/
βββ report.pdf
βββ notes.txt
βββ spreadsheet.xlsx
Extensions:
.zip (when extracted)Organization: Folders/
βββ archive-name/
βββ file1.txt
βββ file2.jpg
βββ subdir/
βββ file3.pdf
Everything else:
Any file type not matching above categoriesOrganization: Others/
βββ data.csv
βββ config.yaml
βββ unknown.xyz
Music Files
Music files are analyzed with ffprobe to extract ID3 tags:
ffprobe -v quiet -show_entries format_tags=artist,album,title,date file.mp3
Extracted metadata:
Artist : Track artist name
Album : Album title
Title : Song title
Year : Release year (from date tag)
Folder Structure
Artist folder
Created in Music/ directory: Music/
βββ Don Toliver/
Album folder
Created inside artist folder with year: Music/
βββ Don Toliver/
βββ Tiramisu (2025)/
If no year in metadata: Music/
βββ Don Toliver/
βββ Tiramisu/
Track files
Uploaded to album folder: Music/
βββ Don Toliver/
βββ Tiramisu (2025)/
βββ 01 - Tiramisu.mp3
βββ 02 - Another Track.mp3
βββ cover.jpg
Cover art is automatically extracted from embedded album art:
ffmpeg -y -i audio_file.mp3 -an -vcodec copy cover.jpg
Features:
Extracted from first track in album
Saved as cover.jpg
Only extracted once per album
Uploaded alongside music files
Example output:
πΏ Don Toliver - Tiramisu (2025) - Tiramisu
β¬ Uploading 8.52MB... β Uploaded 8.52MB
πΌ Cover art... β Cover art uploaded
Metadata is cleaned to remove website spam:
# Before
Artist: "Don Toliver (HipHopKit.com)"
Album: "Tiramisu | Audiomack.com"
# After
Artist: "Don Toliver"
Album: "Tiramisu"
Cleaned patterns:
Website names: HipHopKit.com, Audiomack.com
Platforms: SoundCloud, Spotify, YouTube
Generic domains: [domain].(com|net|org)
Parentheses and pipes around spam
Implementation (from script line 711-713):
artist = $( echo " $artist " | sed -E 's/\s*[\(\|]?\s*(HipHopKit\.com|Audiomack\.com|SoundCloud|Spotify|YouTube|[A-Za-z0-9]+\.(com|net|org))[^\)]*[\)]?//gi' | sed 's/[[:space:]]*$//' )
Handling Existing Albums
When uploading to an album folder that already exists:
Detection
Script checks if album folder already exists: Checking for existing album: Tiramisu (2025)...
β Album folder "Tiramisu (2025)" already exists
Prompt
User is asked: Upload to existing folder? [Y/n]:
Options
Press Y or Enter (default): β Using existing album folder
Uploads to existing album (adds more tracks). Press N: β Uploading to Music root (un-nested)
Uploads directly to Music/Artist/ without album folder.
For music files without metadata:
Metadata: Unknown Artist | Unknown Album | Unknown Title |
Result:
Music/
βββ Unknown Artist/
βββ song.mp3 (no album folder, no cover)
Or if artist exists but album is missing:
Music/
βββ Artist Name/
βββ song.mp3 (no album folder)
ZIP Files
When a ZIP file is detected:
Detection
π¦ ZIP detected
Extract and upload files? (y/n):
User choice
Option 1: Extract (y) Extracting...
β Extracted
Files are extracted and organized by type. Option 2: Upload as-is (n) ZIP uploaded to Others/ category.
Extracted files go to Folders/ category:
Folders/
βββ archive-name/
βββ document.pdf
βββ image.jpg
βββ song.mp3
βββ subdir/
βββ file.txt
Exception: If ZIP contains only music files, theyβre organized by artist/album:
# Input: album.zip containing 10 .mp3 files
# Output:
Music/
βββ Artist Name/
βββ Album Title (2025)/
βββ 01 - Track.mp3
βββ 02 - Track.mp3
βββ ...
βββ cover.jpg
Mixed Content ZIP
ZIP with multiple file types:
# Input: mixed.zip containing:
# - music.mp3
# - photo.jpg
# - doc.pdf
# Output:
Folders/
βββ mixed/
βββ music.mp3
βββ photo.jpg
βββ doc.pdf
Mixed content ZIPs preserve their structure in Folders/ category. Music files inside are NOT organized by artist/album.
Duplicate Detection
Files are checked for duplicates before upload:
MD5 checksum
MD5 = $( md5sum " $file " | awk '{print $1}' )
π MD5: 6d2300f6a025e07ad87991b31023da6a
API query
Check if file with same name exists in destination folder: query = "name='filename.mp3' and 'folder_id' in parents and trashed=false"
Skip if exists
β Already exists, skipping
File is not re-uploaded.
Benefits:
Prevents duplicate uploads
Saves bandwidth
Saves storage quota
Speeds up batch processing
Temporary Files
Download Stage
File/Directory Purpose Cleanup /tmp/<filename>_$$Downloaded file After upload /tmp/tg_download_$$/Telegram staging After upload /tmp/tg_output_$$Telegram logs After upload
File/Directory Purpose Cleanup /tmp/extract_$$/ZIP extraction After upload /tmp/single_$$/Single file staging After upload
Music Processing
File/Directory Purpose Cleanup /tmp/covers_$$/Extracted cover art After upload
Upload Stage
File/Directory Purpose Cleanup /tmp/upload_result_$$API response After processing /tmp/cover_result_$$Cover upload response After processing
Auto cleanup:
Script automatically cleans up after each URL:
rm -rf " $TEMP_FILE " " $EXTRACT_DIR " " $FILES_DIR " /tmp/covers_ $$ 2> /dev/null
Manual cleanup:
If script crashes:
See dedicated guide: Troubleshooting - Temp Files
Persistent Files
Telegram Session
~/.config/gdrive-ingest/telegram/downloader.session
Purpose: Telegram authentication
Size: ~1-2 KB
Cleanup: Only delete to re-authenticate
Google Drive Token Cache
Purpose: Cached access token
Size: Less than 1 KB
Cleanup: Auto-refreshed when expired
Organization Examples
Single Song Upload
./gdrive_ingest.sh https://example.com/song.mp3
Result:
Music/
βββ Don Toliver/
βββ Tiramisu (2025)/
βββ Tiramisu.mp3
βββ cover.jpg
Album Upload
./gdrive_ingest.sh track1.mp3 track2.mp3 track3.mp3
Result:
Music/
βββ Artist Name/
βββ Album Title (2025)/
βββ 01 - Track.mp3
βββ 02 - Track.mp3
βββ 03 - Track.mp3
βββ cover.jpg (extracted once)
Multiple Artists
./gdrive_ingest.sh artist1.mp3 artist2.mp3 artist3.mp3
Result:
Music/
βββ Artist 1/
β βββ Album (2025)/
β βββ song.mp3
βββ Artist 2/
β βββ Album (2024)/
β βββ song.mp3
βββ Artist 3/
βββ Album (2023)/
βββ song.mp3
Mixed File Types
./gdrive_ingest.sh song.mp3 video.mp4 photo.jpg doc.pdf
Result:
Music/
βββ Artist/
βββ Album/
βββ song.mp3
Videos/
βββ video.mp4
Images/
βββ photo.jpg
Docs/
βββ doc.pdf
Customization
Override Folder
Force all files to a specific folder:
./gdrive_ingest.sh --folder "My Folder" song.mp3 video.mp4
Result:
My Folder/
βββ song.mp3 (not organized by artist)
βββ video.mp4
Using --folder overrides automatic categorization. Files upload directly to specified folder.
Create Folders On-The-Fly
In interactive mode:
Select ββ Create new folderβ
Enter folder name: Archive 2025
Files upload to new folder
Next Steps
Usage Examples See real-world organization examples
Interactive Features Master folder navigation
Troubleshooting Fix organization issues
Setup Guide Configure the script