Jump to content

Ajutor VBScript

Recommended Posts

Salut. Am nevoie de un vbscript care sa deleteze toate fisierele de langa el inafara de exemplu.vbs


Sa dau un exemplu.


Am folderul Razvan. In el am 5 fisiere .vbs

Adaug in acel folder vbs-ul meu care odata executat sa deleteze toate fiserele .vbs inafara de exemplu.vbs 


Cum pot face asta.

Edited by oORaZvANOo
Link to post
Share on other sites
Const DeleteReadOnly = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("C/D/E:\path\*.txt"), DeleteReadOnly


Stai, n-am găsit cu excepţie, revin.


Mai bine foloseşti în MS-DOS

for %i in (*) do if not %i == a.c del %i


Edited by kidink
Link to post
Share on other sites

Ia vezi asa




Set fso = CreateObject("Scripting.FileSystemObject")
AppPath = fso.GetAbsolutePathName(".")

Set fsoFolder = fso.GetFolder(AppPath)
Set fsoFiles = fsoFolder.Files

For Each fsoCurrentFile in fsoFiles
    if not fsoCurrentFile.Name = WScript.ScriptName then
		' Delete file
		fso.DeleteFile fsoCurrentFile.Path
	end if


Edited by Wav3
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...