QUESTION: Dear Sir, I am intermediate level programmer,my question is i want to list all the files from several folders inside a Main folder in listview or any control and when ever there is a new file added to any folder or renamed any files or deleted any file, automatically the listview should be updated with the changes in any folder.
please help me in this regards sir.Thanking u so much sir.
ANSWER: you need to run this programme after a file has been added then it can identify all files including the latest file added. Obviously the list cannot be updated if this vb exe is Not run.
---------- FOLLOW-UP ----------
QUESTION: Yes Mr.Ravindra, it is working fine if i run, but i have 3000 files from different folders, it is taking long time to load all files again. I just do not need to load all files again.i need only the new files,changes should be reflected. I have seen a application which load all files from several folders and i can see immediately the status of any file changes in any folder without taking even 2 seconds. I wonder how it is possible.
Please see the snapshot for better understanding.In this pic the first file with Pending status will change to Completed soon and i can see changes immediately.Please help me sir.
one solution would be to load the previously loaded files of the listbox into a text file; load these files from the textfile onto the listbox and append the latest file from a given date:
the code would be like this:
Dim MyStamp As Date
Private Sub Command1_Click()
Dim strStartPath As String
strStartPath = "F:\Current" 'ENTER YOUR START FOLDER HERE
Private Sub ListFolder(sFolderPath As String)
Dim FS As New FileSystemObject
Dim FSfolder As Folder
Dim File As File
Dim i As Integer
Dim temp As Date
Set FSfolder = FS.GetFolder(sFolderPath)
Text1.Text = ""
Dim testDate As Date
testDate = "06/18/2014"
For Each File In FSfolder.Files
MyStamp = Format(FileDateTime(File), "DD-MMM-YY")
If MyStamp > testDate Then
Text1.Text = Text1.Text & File & Space(5) & MyStamp & vbCrLf
Set FSfolder = Nothing
Try it out and make some changes as you need. you need to change the date and folder path which could be chosen from a listbox or textbox