Expected identifier when trying to delete file 2004-04-26 - By Will Mendez
Back Hey Bernard,
instead of fso.delete( oToRemove );
use
fso.deleteFile( oToRemove );
see if that helps.
/Will
-- --Original Message-- -- From: owner-xsi@(protected) [mailto:owner-xsi@(protected)]On Behalf Of Bernard Lebel Posted At: Monday, April 26, 2004 3:56 AM Posted To: xsi Conversation: [Script] Expected identifier when trying to delete file Subject: [Script] Expected identifier when trying to delete file
Hello,
I've done this many this many times, but now for the life of me I can't make it work. I'm trying to delete a file using a FileSystemObject, and the script always barfs an error "expected identifier". But the thing is I CAN get the file, but deleting it doesn't work! The error occurs at the fso.delete( oToRemove ) line.
for( var j = new Enumerator( oFolderColl2 ); !j.atEnd(); j.moveNext() ) { var oFolder = fso.getfolder( j.item() ); var oFiles = oFolder.files;
if( oFiles.count > 0 ) { for( h = new Enumerator( oFiles ); !h.atEnd(); h.moveNext() ) { var oFile = fso.getfile( h.item() ); var sFileName = oFile.name;
if( sFileName.match( /(.tyy)/ ) ) { oFileColl.add( oFile ); } } } }
if( oFileColl.count > 0 ) { for( var i = new Enumerator( oFileColl ); !i.atEnd(); i.moveNext() ) { var oToRemove = fso.getfile( i.item() ); // Troublesome line fso.delete( oToRemove ); } }
Thanks
Bernard --- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|