'프로그램언어/JavaScript'에 해당되는 글 2건

  1. 2012.11.21 로컬PC 파일목록 가져오기
  2. 2012.11.21 시스템 폴더 경로 구하기

정말 어렵게 찾은 자료다.

자바스크립은 로컬PC의 파일정보를 가져올수 없다고만 나오는데,

겨우 찾은 로컬PC 파일목록 가져오는 소스다.

 

 - 코딩

 

<html>
<head>
</head>
<body onload=test()>
<script>

function test()
{
  var fso;
  fso = new ActiveXObject("scripting.FileSystemObject");
  var srt = fso.GetFolder("c:\\");
  var fc = new Enumerator(srt.files);
  for (; !fc.atEnd(); fc.moveNext())
    document.write(fc.item().name + "<br>\n");
}

</script>
</body>
</html>
 

 

- 실행결과

 

bootfont.bin
BzIcons.dll
IO.SYS
MSDOS.SYS
NTDETECT.COM
ntldr
pagefile.sys 

 

'프로그램언어 > JavaScript' 카테고리의 다른 글

시스템 폴더 경로 구하기  (0) 2012.11.21
Posted by 투덜ⓔ

자바 스크립트로 특정 시스템 폴더의 경로를 반환한다.

 

0 윈도우폴더

1 시스템폴더

2 임시폴더

 

GetSpecialFolder Method
Returns the special folder object specified.
object.GetSpecialFolder(folderspec)
  Arguments
object
Required. Always the name of a FileSystemObject.
folderspec
Required. The name of the special folder to be returned. Can be any of the constants shown in the Settings section.
  Settings
The folderspec argument can have any of the following values:
Constant
 Value
 Description

WindowsFolder   0  The Windows folder contains files installed by the Windows operating system.
SystemFolder    1  The System folder contains libraries, fonts, and device drivers.
TemporaryFolder 2  The Temp folder is used to store temporary files. Its path is found in the TMP environment variable.

The following example illustrates the use of the GetSpecialFolder method.

 

출처: MSDN (http://msdn.microsoft.com/en-us/library/a72y2t1c(VS.85).aspx)

function getSpecialFolderPath(opt)
{
 var fso = new ActiveXObject('Scripting.FileSystemObject');
 return fso.GetSpecialFolder(1);
}

 

'프로그램언어 > JavaScript' 카테고리의 다른 글

로컬PC 파일목록 가져오기  (0) 2012.11.21
Posted by 투덜ⓔ