Forum Moderators: coopster

Message Too Old, No Replies

PHP dir listing of local files?

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

         

davidpbrown

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

10+ Year Member



Can PHP provide a directory listing of local files?

I need a list of filenames within a directory, including it's subdirectories, on Windows XP. Most filenames include characters outside the standard western set.

Windows filenames are apparently UTF16 and, on English XP, the 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.

This following a post [webmasterworld.com] to the Microsoft Windows OS forum.

Any ideas - I'm stumped.

jatar_k

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

WebmasterWorld Administrator 10+ Year Member



I know a bunch of ways to list all files in a dir but I have done those on *nix boxes mostly, not sure how to swap charset

did you get any farther with this?

DrDoc

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

WebmasterWorld Senior Member 10+ Year Member



You need to change the active code page.

chcp ***

Not sure what the exact code page number you need would be ...

davidpbrown

5:04 pm on Mar 12, 2006 (gmt 0)

10+ Year Member



Thanks for the suggestions.

My code page was already set as multilingual 850 and wouldn't accept CHCP 65001 (UTF8) - maybe limitation of Home XP?

I also tried a variety of other things including an unsuccessful use of Cscript.exe.

Finally today had some inspiration and used EmEditor's 'Find in Files' to seek something common to all the files.

:)