oORaZvANOo Posted February 10, 2016 Report Posted February 10, 2016 (edited) 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 February 10, 2016 by oORaZvANOo Quote
kidink Posted February 10, 2016 Report Posted February 10, 2016 (edited) 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 February 10, 2016 by kidink Quote
Wav3 Posted February 10, 2016 Report Posted February 10, 2016 Cu FSO. Faci for pe fisierele din folderul curent si stergi doar daca (if not) filename nu este egal cu exemplu.vbs. Daca vrei cod concret zi-mi si-ti dau. Quote
oORaZvANOo Posted February 10, 2016 Author Report Posted February 10, 2016 Da as dori un cod concret. Nu am mai folosit for pana acum in vbscript. Sunt familiarizat cu cel din php si cam atat Quote
Wav3 Posted February 10, 2016 Report Posted February 10, 2016 (edited) 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 Next Edited February 10, 2016 by Wav3 Quote
oORaZvANOo Posted February 10, 2016 Author Report Posted February 10, 2016 Mersi merge De aici il adaptez eu la ce imi trebuie. Quote