Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find specific file exist in a folder
#1
Not Solved
Hi,

How I can write a descriptive program to check whether any .mp4 file exist in a particular folder starting with a specific name like 'clip' (eg. clip0019.mp4)

the below code shows clip0019.mp4 exists if the file is in c folder. I want to check any file starting with clip in .mp4 format exist in c: folder

Code:
filespec = "C:\clip0019.mp4"
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(filespec)) Then
msg = filespec & " exists."
Else
msg = filespec & " doesn't exist."
End If
MsgBox (msg)

Please help me for this

Thanks in advance.
Reply
#2
Not Solved
Code:
sFolderName = "c:\foldername"
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(sFolderName) Then
                  Reporter.ReportEvent micWarning, "Unable to Get The Files", "Unable to get the File from the location "&sFolderName&". This may be due to the wrong foldername. Looking for. "
End If
Set fBefore = fso.GetFolder(sFolderName)
Set fcBefore = fBefore.Files
For each fb in fcBefore
       If Left(fb.Name, 4) = "clip" and Right(fb.Name,4) = ".mp4" Then
             print fb.Name
       End If
Next





This will print all the files in a folder where file name starts with "clip" and endd with ".mp4"
This will print all the files in folder where the file name starts with "clip" and ends with ".mp4"

Code:
sFolderName = "c:\foldername"
    
    Set fso = CreateObject("Scripting.FileSystemObject")

    Set fBefore = fso.GetFolder(sFolderName)

    Set fcBefore = fBefore.Files
    
    For each fb in fcBefore
            If Left(fb.Name, 4) = "clip" and Right(fb.Name, 4) = ".mp4" Then
                    print fb.Name
            End If
    Next


THis will print all the files in a folder starts wirh clip and ends with .mp4
Code:
sFolderName = "c:\foldername"
    
    Set fso = CreateObject("Scripting.FileSystemObject")

    Set fBefore = fso.GetFolder(sFolderName)

    Set fcBefore = fBefore.Files
    
    For each fb in fcBefore
            If Left(fb.Name, 4) = "clip" and Right(fb.Name, 4) = ".mp4" Then
                    print fb.Name
            End If
    Next


This will print all the files in folder where the file name starts with "clip" and ends with ".mp4"

Code:
sFolderName = "c:\foldername"

Set fso = CreateObject("Scripting.FileSystemObject")

Set fBefore = fso.GetFolder(sFolderName)

Set fcBefore = fBefore.Files

For each fb in fcBefore
If Left(fb.Name, 4) = "clip" and Right(fb.Name, 4) = ".mp4" Then
print fb.Name
End If
Next


--------------------------------------------------------------------------------
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to find a specific link mv8167 1 2,596 01-24-2012, 03:09 AM
Last Post: mv8167

Forum Jump:


Users browsing this thread: 1 Guest(s)