Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. getting files inside sub folder

getting files inside sub folder

Scheduled Pinned Locked Moved Visual Basic
debuggingtutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dennymw
    wrote on last edited by
    #1

    Hello friends, How to get files inside subfolder. this is the code i used to get files inside a folder, How can i use this code to get the file inside the folder or subfolders. these code wil consider the files inside folder only. sPath1 = "C:\common share\" sFileNm = Dir(sPath1, vbNormal) 'Get the first file from the specified directory For Each sFileNm1 In objFolder1.Files 'If the file has a txt extension then print the file name If Right(sFileNm, 3) = "txt" Then Debug.print sFileNm1 End If sFileNm = Dir Next "C:\common share\ " May or maynot contains subfolder, if present want to check the subfolder also. Can i get the code for these. Thanks and regards Jishith

    A 1 Reply Last reply
    0
    • D dennymw

      Hello friends, How to get files inside subfolder. this is the code i used to get files inside a folder, How can i use this code to get the file inside the folder or subfolders. these code wil consider the files inside folder only. sPath1 = "C:\common share\" sFileNm = Dir(sPath1, vbNormal) 'Get the first file from the specified directory For Each sFileNm1 In objFolder1.Files 'If the file has a txt extension then print the file name If Right(sFileNm, 3) = "txt" Then Debug.print sFileNm1 End If sFileNm = Dir Next "C:\common share\ " May or maynot contains subfolder, if present want to check the subfolder also. Can i get the code for these. Thanks and regards Jishith

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      One way is recursion. A quick google will provide you with many examples.

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups