Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Lists files with CJK characters
- 'Usage e.g.: cscript listcjk.vbs "d:\my files"
- set fs = createobject("scripting.filesystemobject")
- function iscjk(fn)
- dim i, c
- iscjk = false
- for i = 1 to len(fn)
- c = ascw(mid(fn, i, 1))
- if _
- ((c >= &H1100) and (c <= &H11ff)) or _
- ((c >= &H2e80) and (c <= &H2eff)) or _
- ((c >= &H2ff0) and (c <= &H2fff)) or _
- ((c >= &H3000) and (c <= &H318f)) or _
- ((c >= &H30a0) and (c <= &H30ff)) or _
- ((c >= &H31a0) and (c <= &H4dbf)) or _
- ((c >= &H4dc0) and (c <= &H9fff)) or _
- ((c >= &Ha960) and (c <= &Ha97f)) or _
- ((c >= &Hac00) and (c <= &Hd7ff)) or _
- ((c >= &Hf900) and (c <= &Hfaff)) or _
- ((c >= &Hfe30) and (c <= &Hfe4f)) or _
- ((c >= &H1b000) and (c <= &H1b0ff)) or _
- ((c >= &H1f200) and (c <= &H1f2ff)) or _
- ((c >= &H20000) and (c <= &H2a6df)) or _
- ((c >= &H2a700) and (c <= &H2b81f)) or _
- ((c >= &H2f800) and (c <= &H2fa1f)) then
- iscjk = true
- exit for
- end if
- next
- end function
- sub list(path)
- dim dir, file, s, subdir
- set dir = fs.getfolder(path)
- s = dir.path
- if right(s, 1) <> "\" then s = s & "\"
- for each file in dir.files
- if iscjk(file.name) then wsh.echo s & file.name
- next
- for each subdir in dir.subfolders
- list s & subdir.name
- next
- end sub
- if wsh.arguments.count = 0 then
- wsh.echo "Usage: listcjk {path}"
- wsh.quit 1
- end if
- if not fs.folderexists(wsh.arguments(0)) then
- wsh.echo "Path is not found or invalid."
- wsh.quit 2
- end if
- list wsh.arguments(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement