Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







WSH Forum

Author Thread: datamanipulation in WHS
karthiksaranya
datamanipulation in WHS
Posted: Monday, April 09, 2007 10:23 AM (PST)

Hi,

      can u give me some samples for deleting a file, moving a file.


Comments:

Author Thread:
javaman
datamanipulation in WHS
Posted: Monday, April 16, 2007 1:28 PM (PST)
in jscript it would be: fs = new ActiveXObject("Scripting.FileSystemObject") fs.MoveFile("C:\\file1.txt","C:\\My Documents\\file1.txt") fs.DeleteFile("C:\\My Documents\\file1.txt")

4scriptomini
datamanipulation in WHS
Posted: Friday, May 04, 2007 1:33 AM (PST)
I my delete Okb script: Sub DeleteFile(folderspec) 'Costanti per decidere la modalità di apertura file Const ForReading = 1, ForWriting = 2, ForAppending=8 Dim fs 'oggetto FileSystem Dim f 'oggetto folder Dim f1 'oggetto file SmtpLog da cancellare Dim fc 'array di file SmtpLog 'Creo l'oggetto FileSystem Set fs = CreateObject("Scripting.FileSystemObject") 'Lo script gira solo se la folder esiste If (fs.FolderExists(folderspec)) Then 'ciaoWScript.Echo "Folder esiste" 'Creo l'oggetto folder Set f = fs.GetFolder(folderspec) 'Ricavo i file contenuti nell'oggetto folder Set fc = f.Files 'Ripeto le operazione contenute tra FOR e NEXT per ogni file ricavato For Each f1 in fc 'Ricavo il nome del file strFile=f1.name nSize=f1.size If ( (nSize=0) And (UCase(right(strFILE,4))=UCase(".txt")) ) Then 'cancello il file f1.delete WScript.Echo "Cancellato file : " & strFile End If Next Else WScript.Echo "Folder non esiste" End If End Sub 'RICHIAMO LA FUNZIONE PASSANDOGLI FOLDER E DATA Dim strFolder '############################################################################################# strFolder = "C:\hp\tools\internal" 'DA MODIFICARE DA MODIFICARE DA MODIFICARE '############################################################################################# DeleteFile strFolder check out at www.xoroz.com for more scripts



WSH and ADSI Administrative Scripting


Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon