Wednesday, December 16, 2009

Lange bestandsnamen inkorten, How to shorten long file names


Als ik via Juice podcasts download zitten er vaak bestanden bij met een gigantisch lange naam. Het laatste deel van de bestandsnaam zijn tracking markers. Mijn MP3 spelers (allemaal iRivers) kunnen die extreem lange bestandsnamen niet aan. Het gevolg is dat ze als er een lange bestandsnaam op staat die iRivers continue in een reboot loop komen. Dan moet ik ze weer even via de USB kabel aansluiten om de lange bestandsnamen in te korten.

Die bestanden zien er dan ongeveer zo uit:
PodcastBestand_nvb_20091207174750_nva_200912081757.mp3
met heel veel "nva" en "nvb" referenties.

Sinds enige tijd gebruik ik nu FileNameFixer. Dit programmatje kun je instellen op een vaste directory en een maximale bestandslengte. Nadat alle MP3 bestanden in één directory zijn verschoven (bij Juice in het [Preferences]-[Advanced] gedeelte met het volgende script: move "%f" "C:\Podcasts\TempFiles\") laat ik eerst FileNameFixer zijn werk doen alvorens een batch scriptje te draaien die alle podcasts op de zelfde geluidssterkte zet. Dat scriptje ziet er zo uit:

"C:\Program Files\MyPrograms\mp3gain.exe" /r /d -4 /c /p C:\Podcasts\TempFiles\*.mp3
Move /Y C:\Podcasts\TempFiles\*.mp3 C:\Podcasts\LevelledFiles\
Move /Y C:\Podcasts\TempFiles\*.* C:\Podcasts\RemainingFiles\
%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState

De eerste regel start het programma mp3gain in command line mode en loopt alle zojuist gedownloade podcasts door om ze allemaal het zelfde geluidsniveau te geven. Daarna worden alle MP3 bestanden gekopieerd naar LeveledFiles en alle overige files (meestal video bestanden of PDF's) naar RemainingFiles. Het laatste commando zet de PC in slaap. Soms gebruik ik op de laatste regel: shutdown.exe -s -f als ik de PC na afloop wil laten afsluiten.

UPDATE: Omdat ik alles via een script wilde laten werken heb ik het inkorten van lange bestandsnamen als DOS script uitgewerkt. Ga naar het volgende artikel om te lezen hoe je dit automatisch in DOS kunt doen: Podcast-manipulatie-script

Cutting long podcast file names.
Some podcasts have long tracking postfixes in their file names which makes my iRivers contstanly reboot. A few months ago, I added an extra step in my download procedure.
I download the podcasts with Juice and within Juice I automatically copy all the files to one central directory (in Juice [Preferences]-[Advanced] add the following script: move "%f" "C:\Podcasts\TempFiles\"). Then I use FileNameFixer to automatically cut the long file names to a maximum length of 60 characters (with a default directory of C:\Podcasts\TempFiles and a default file length of 60). Ater that I run the script above to make sure all audio levels are the same, as I hate these huge variations in recording levels between different podcasts. After processing the mp3 files, the mp3's are copied to LeveledFiles and the remaining files (mostly video and pdf's) are copied to RemainingFiles. The last command line puts the PC in suspend (sleep) mode as I often run the mp3gain script at night.

UPDATE: Since I want to run everything in a script, I created a DOS script to automatically reduce long file names to a fixed maximum length. To read more about this script follow this link: Podcast manipulation script

No comments:

Post a Comment