January 05, 2008

Unicode Text Listings from CMD prompt

Posted at January 5, 2008 02:42 PM in Software .

I generally have a habit of indexing CDR and DVDR that I burn by doing a handy command from the command prompt in Windows. This had caused me headache as I started becoming more wordly and getting more cases of files with Unicode names.

The problem can be shown here:
12/26/2007 01:36 PM 5,345,915 ?? - ??? ??.mp3
12/26/2007 01:36 PM 5,509,546 ?? - ???? (Feat. ??).mp3
12/26/2007 03:21 AM 5,598,336 ?? - ??? ????.mp3

If I do Start -> run -> cmd and press enter. Then I navigate to the drive and directory with the CDR or DVDR that I want to catalog and do:

dir /s > c:\catalog\CDRNAME.txt

This command is directory with subdirectory listings streamed to a file named CDRNAME.txt located in c:\catalog. It is good for quickly looking for content on your CDR or DVDR without having to insert each one in the drive and waiting for the load time. Instead you keep the labels in sync with the file name and you can use Windows search or GREP to find file names in the files. When you find the file containing the file name you were looking for you can insert the right CDR or DVDR right away!

With that I get a nice text file listing out the contents of the directories. However, as you see with all those ? characters and keeping in mind ? is not valid in a filename, you know that wasn't what I meant to do! I lost searchable info!

I was writing some code to do what I wanted, but then I decided Windows HAD to have a feature like that. It seems they do! Next time do:

If I do Start -> run -> cmd /u and press enter. The U is for unicode. From the cmd.exe help file:

"/U Causes the output of internal commands to a pipe or file to be Unicode"

You will still see the ? when you do a simple dir command (would also love to hear a native Windows workaround or command to that), but when you do a stream to a file you will get the following:
12/26/2007 01:36 PM 5,345,915 휘성 - 다쳐도 좋아.mp3
12/26/2007 01:36 PM 5,509,546 휘성 - 만져주기 (Feat. 윤하).mp3
12/26/2007 03:21 AM 5,598,336 휘성 - 사랑은 맛있다♡.mp3

Looks much better to me!


no one cares

Posted by at January 11, 2008 03:53 PM
Posting of new comments has been disabled for this post.