Results 1 to 2 of 2

Thread: Call a procedure depending on file extention

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    68

    Call a procedure depending on file extention

    Hi.

    How would i go about checking a file extention to see if it is either
    '.exe' or '.ex_'

    What i need to be able to do is that if the extention of the file is '.ex_' then that file is copied to another folder, or if the file extention is '.exe' then it is passed onto another routine that will compress is.

    Baring in mind that there could be a number of files in that folder.

    I already have a routine that will compress the files, just need the above.

    Many Thanks

    tstrike

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: Call a procedure depending on file extention

    Use the System.IO.Path.GetExtension method to get the extension of a file. Do a simple comparison against the extensions you want to handle, and call different methods based on the comparison.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width