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. C#
  4. Copy files, not folders ?

Copy files, not folders ?

Scheduled Pinned Locked Moved C#
question
3 Posts 3 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.
  • V Offline
    V Offline
    Vector7
    wrote on last edited by
    #1

    Hello, how I am able to filter directories and copy real files only ? C:\Temp\Subfolder\ C:\Temp\readme.txt (Copy only readme.txt, not the Subfolder) I am using foreach(string Element in Files) for getting all elements in a directory.

    C S 2 Replies Last reply
    0
    • V Vector7

      Hello, how I am able to filter directories and copy real files only ? C:\Temp\Subfolder\ C:\Temp\readme.txt (Copy only readme.txt, not the Subfolder) I am using foreach(string Element in Files) for getting all elements in a directory.

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Vector7 wrote: foreach(string Element in Files) That doesn't explain very much. What is Files? A StringCollection, or what? Where did it come from? How was it created?


      Do you want to know more? WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums

      1 Reply Last reply
      0
      • V Vector7

        Hello, how I am able to filter directories and copy real files only ? C:\Temp\Subfolder\ C:\Temp\readme.txt (Copy only readme.txt, not the Subfolder) I am using foreach(string Element in Files) for getting all elements in a directory.

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        Use the Directory.GetFiles method to obtain the names of files in a specific directory and afterwards copy the files by using an overload of the File.Copy method.


        www.troschuetz.de

        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