Welcome to WebmasterWorld Guest from 54.161.88.189

Forum Moderators: bill

Message Too Old, No Replies

Get dir listing including uft16 filenames

dir /b /s *.* >filelist.txt gives?'s

     
11:25 am on Mar 4, 2006 (gmt 0)

Full Member

10+ Year Member

joined:May 27, 2003
posts:245
votes: 0


Windows filenames are apparently UTF16. I need to get a list of files within a directory in Windows XP. Most of the filenames include characters outside standard western set.

DOS command
dir /b /s *.* >filelist.txt
seems to work only for ~ASCII so I end up with '?' marks for each character outside this.

I've tried Xenu but it didn't pick them up as orphan files.

Any ideas - I'm stumped.

Can PHP access directory listings maybe?

8:42 am on Mar 5, 2006 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14767
votes: 81


Did you try all the options in this recent thread?
Need to export filenames to a file [webmasterworld.com]

Dropping the folder into a browser window was one tip that might work for you.

11:45 am on Mar 5, 2006 (gmt 0)

Full Member

10+ Year Member

joined:May 27, 2003
posts:245
votes: 0


Thanks Bill..

Firefox declares an error.
"Firefox can't find the file at /G:/test/?."

It appears just to ignore any filename with any character outside the ~ASCII set!

Also, doing that simply lists files in current directory c.f. Explorer.

I'm looking to get a lists of all files including those in subdirectories.. ~40k of them.

I did wonder if DOS had a suitable upgrade but haven't found one.

I just took a look at Total Commander.. it doesn't seem to have a suitable export file/directory list function.

I could run a java or PHP solution if there is one.. I don't know those well enough to know what's avaliable.

1:39 am on Mar 6, 2006 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14767
votes: 81


What language are these file names in? I run several copies of Windows in virtual PC environments and can print out non-ASCII names if I use a native OS. I just tested this out with Japanese and Chinese and all worked well. Do you have access to a machine that uses the same language OS as the file names?

I'm not the best person to ask about PHP functions. You might want to post this question in our PHP forum [webmasterworld.com] and see if they can help.

9:37 am on Mar 6, 2006 (gmt 0)

Full Member

10+ Year Member

joined:May 27, 2003
posts:245
votes: 0


Filenames are in Chinese.

Good to know it works on other language platforms - suggests there might well be a hack avaliable.

I'll ask PHP forum.

Thanks

5:58 pm on Mar 8, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


You need to change the active code page.

chcp ***

Not sure what the exact code page number you need is ... (850?)
[microsoft.com...]

Type

chcp
to see what the current code page is (perhaps 437). Then set up a batch file or something:

chcp [new cp]
dir /b /s *.* >filelist.txt
chcp [olc cp]