This is driving me nuts!

From: kackson (kackson_at_yahoo.com)
Date: 03/08/04


Date: 8 Mar 2004 06:16:24 -0800

Hi.

Here's my snapshot of my codes:

var fso = WScript.CreateObject ("Scripting.FileSystemObject");
var item = args.Item (i); // argument input from user. the folder
path.
folder = fso.GetFolder (item);
fc = new Enumerator (folder.Files);
for (; !fc.atEnd (); fc.moveNext ())
{
file = fc.item();
WScript.Echo(file);
}

My problem is: all the files are printed with a '.' infront of it! And
so if I try to open the file, I will always get file not found error.
e.g. instead of having [c:/myfolder/stupidfile.ext], I get
[c:/myfolder/.stupidfile.ext]. So, there's always a '.' infront of the
file name. I've tried all methods but cant get it to report without
the '.' before the filename. I've tried many files and they all end up
the same. I dont know how or where does the '.' come in. Maybe it
meant current directory.(?!?) I'm on WindowsXP SP1. All help/pointers
are much appreciated. Thanks.



Relevant Pages

  • Re: Input on CleanUp script
    ... And cross fingers you have a backup. ... just exclude one folder from precaution. ... > var fso, targetFolder, backupFolder, deleteDays, cd, useBackup; ... that meet the deletedays criteria. ...
    (microsoft.public.scripting.wsh)
  • Re: Input on CleanUp script
    ... And cross fingers you have a backup. ... just exclude one folder from precaution. ... > var fso, targetFolder, backupFolder, deleteDays, cd, useBackup; ... that meet the deletedays criteria. ...
    (microsoft.public.scripting.jscript)
  • Re: Concatenate Files in VBS or JS Windows Scripting
    ... everything works and the code loops thru ... contains .cmi or not, I get a Microsoft JScript runtime error with code: ... var fso = new ActiveXObject; ... //dir is the variable that contains the folder path and name passed to ...
    (microsoft.public.scripting.wsh)
  • Re: Deleting folder fails because the folder isnt empty
    ... so I test instead with a folder on the D drive ... C instead and edit the script. ... Create lots of subfolders under it ... var oLoc = new ActiveXObject; ...
    (microsoft.public.win32.programmer.wmi)
  • Re: singleton ienumerable, need to add more...
    ... public Folder this[int rowIndex] ... it is unusual for something to be enumerable and an enumerator; ... Thread safety: since you appear new to C# this probably won't be an ...
    (microsoft.public.dotnet.languages.csharp)