2

Is it possible to manage files and directories (i.e. get a directory's content, create/copy/delete files, etc.) usig javascript in WSH ?
I did a quick look at MSDN and I cant find an object that let me do that.

GetFree
  • 40,278
  • 18
  • 77
  • 104

2 Answers2

4

Is FileSystemObject what you're looking for?

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
2
var fso = WScript.CreateObject("ScriptingFileSystemObject");
var CurDir = fs.GetFolder("C:\\temp");
var Files = CurDir.Files;
for(var fileitem = new Enumerator(Files); !fileitem.atEnd(); fileitem.moveNext())
{
   fso.CopyFile(fileitem.item(), ExeDir);
}

See MSDN documentation on FSO.

Kevin Buchs
  • 2,520
  • 4
  • 36
  • 55