Rename children's video files based on their age at the time of recording
npm install kids-video-renamerAutomatically rename children's video files based on their age at the time of recording.
- 📅 Extracts creation date from multiple sources (filename, macOS metadata, file modification time)
- 🎂 Calculates child's age at the time of recording
- 📝 Renames files in the format: {Name}_{Years}Y{Months}M_{Sequence}.{ext}
- 👀 Preview mode to see changes before applying
- 🔄 Safe two-phase rename to avoid conflicts
``bash`
npm install -g kids-video-renamer
`bash`
npm install kids-video-renamer
`bashPreview mode (default)
kids-rename . --name Cindy --birthday 2018-04-18
$3
-
[directory] - Video directory (default: current directory)
- -n, --name - Child's name (required)
- -b, --birthday - Birthday in YYYY-MM-DD or YYYY/MM/DD format (required)
- -d, --dry-run - Preview mode (default)
- -e, --execute - Actually execute the rename operation
- -V, --version - Output version number
- -h, --help - Display help informationExample
$3
`
Video 2019-7-22.mov
DJI_20240728111023.mp4
2021-05-19 17-52-42.mov
`$3
If the child's name is "Cindy" and birthday is "2018-04-18":
`
Cindy_1Y3M_1.mov # 1 year 3 months old
Cindy_6Y3M_1.mp4 # 6 years 3 months old
Cindy_3Y1M_1.mov # 3 years 1 month old
`Supported Video Formats
-
.mov
- .mp4
- .m4v
- .avi
- .mkvDate Detection
The tool tries to extract the creation date in the following order:
1. Filename patterns:
-
Video 2019-7-22 or 影片 2020-2-5
- 2021-05-19 17-52-42.mov
- DJI_202407281110232. macOS metadata (using
mdls command)3. File modification time (fallback)
How It Works
1. Scans the directory for video files
2. Extracts creation date from each file
3. Calculates the child's age (years and months) at that date
4. Generates new filename:
{Name}_{Years}Y{Months}M_{Sequence}.{ext}
5. Sequence numbers are auto-incremented for videos from the same age period
6. Uses two-phase rename to avoid conflictsProgrammatic Usage
`javascript
const { renameVideos } = require('kids-video-renamer');renameVideos({
directory: './videos',
name: 'Cindy',
birthday: '2018-04-18',
execute: true
});
`Requirements
- Node.js >= 14.0.0
- macOS (for
mdls` metadata extraction, optional)MIT
Issues and pull requests are welcome!