lincolnnavigator Posted July 30, 2009 Share Posted July 30, 2009 Hi.I need script in *.bat which will do the deletion of files, older tnen for example 10 days. I have one vbs, which i found on the internet. Dim FsoDim DirectoryDim ModifiedDim FilesSet Fso = CreateObject("Scripting.FileSystemObject")ListFolderContents("E:\Backup")Sub ListFolderContents(path)Set fs = CreateObject("Scripting.FileSystemObject")Set folder = fs.GetFolder(path)For each item in folder.SubFoldersDeleteFiles(item.Path)NextSet folder = Nothingset fs = NothingEnd SubSub DeleteFiles(Dir)Set Directory = Fso.GetFolder(Dir)Set Files = Directory.FilesFor Each Modified In FilesIf DateDiff("D", Modified.DateLastModified, Now) < 1 Then Modified.DeleteNextEnd SubThis code is not working, i dont know why? Have anyone simple *bat file or can anyone mode this script.Tnx. Link to comment Share on other sites More sharing options...
jcarle Posted August 1, 2009 Share Posted August 1, 2009 That's not a batch file, that a VBScript file. Change your file extension to .vbs. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now