I have a audio player that sorts files by creation / modification date, so i need the creation date to match the track number for the album to play in proper order. Pic rel is one folder where the date is the same on every file, but i need some some kind of program that can modify these so file 01 has the earliest date and then it grows with every with every next file. I'm using Linux mInt
>>1564568You could probably do that with a python script, ask chatgpt
>>1564568I think Bulk Rename Utility can do this...?>>1564573>ask chatgptBot response
>>1564568literally just "touch", the command line utility
Metamorphose. This is a super powerful utility.And you can try and press on the words Origin and Renamed to modify sort order. Might work. Might not.
>>1564568Have you considered using a less shitty audio player?
#!/bin/bash# fix_track_timestamps.sh# Sets file modification/access times so files sort in filename order.# Each file gets a timestamp 1 minute apart, starting from a base date.## Usage:# ./fix_track_timestamps.sh /path/to/album/folder# ./fix_track_timestamps.sh <- uses current directoryTARGET_DIR="${1:-.}"# Base timestamp: change this if you want a different starting pointBASE_DATE="2000-01-01 00:00:00"# Audio file extensions to process (add more if needed)EXTENSIONS="mp3|flac|ogg|wav|aac|m4a|wma|opus|ape|mpc|aiff|alac"echo "=== Track Timestamp Fixer ==="echo "Folder : $TARGET_DIR"echo "Base : $BASE_DATE"echo ""# Collect and sort matching files by filename (natural sort handles 01, 02 ... 10, 11 correctly)mapfile -t FILES < <(find "$TARGET_DIR" -maxdepth 1 -type f \ | grep -iE "\.($EXTENSIONS)$" \ | sort -V)if [ ${#FILES[@]} -eq 0 ]; then echo "No audio files found in '$TARGET_DIR'." exit 1fiecho "Found ${#FILES[@]} file(s). Applying timestamps..."echo ""# Convert base date to Unix epoch secondsBASE_EPOCH=$(date -d "$BASE_DATE" +%s)INTERVAL=60 # seconds between each file (1 minute)for i in "${!FILES[@]}"; do FILE="${FILES[$i]}" BASENAME=$(basename "$FILE") NEW_EPOCH=$(( BASE_EPOCH + i * INTERVAL )) NEW_STAMP=$(date -d "@$NEW_EPOCH" +"%Y%m%d%H%M.%S") # format for 'touch' NEW_HUMAN=$(date -d "@$NEW_EPOCH" +"%Y-%m-%d %H:%M:%S") # -t sets both access and modification time; no creation time on Linux ext4 touch -t "$NEW_STAMP" "$FILE" printf " [%02d] %-45s -> %s\n" "$((i+1))" "$BASENAME" "$NEW_HUMAN"doneecho ""echo "Done! All timestamps updated."echo ""echo "TIP: On Linux, 'creation time' (birth time) is not reliably settable."echo "Most players sort by *modification* time, which this script updates."echo "If your player uses birth time, see the notes in the README below."
>>1564568exiftoolYou'll have to look it up because I'm not an expert.You'll want to use a substring of the first two characters from the filename and write to the CreateDate. If the program sorts by time not just the day date then you can write to the seconds or minutes, and with more files than days per months or seconds per minute you can use a variable to increment the month or minute while decrementing integer value of the filename's first two characters back to 00 or 01
>>1564605Thanks, seems like this could work. Might just need some time to figure this stuff out