Results 1 to 2 of 2

Thread: Renaming files

  1. #1

    Thread Starter
    Member jbailey01's Avatar
    Join Date
    Jul 2012
    Posts
    45

    Question Renaming files

    Hello all,

    I am currently stuck. What I am trying to do is have my program find a file and rename it. The only issue is that the files names are unpredicatable. I can guarentee every file will include the words ABC but for the rest its very random. A example of 3 seperate files would be ABC-24543256 , ABC-00124839, ABC-05483999
    Would anyone know of a good method to just find the ABC part of the file, and rename it completely?

    Thank you.

  2. #2
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    2,012

    Re: Renaming files

    You can use wildcard characters to get a list of all files that start with "ABC":

    Code:
    Dim files() As String = IO.Directory.GetFiles(myFolder, "ABC*.*")
    Then use

    Code:
    My.Computer.FileSystem.RenameFile(fileName, newName)
    to rename each one.

Tags for this Thread

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