Results 1 to 5 of 5

Thread: File properties

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    21

    File properties

    Hi everybody,

    I urgently need a small application to do the following:
    Take all files in a certain folder.
    Take the first 4 characters of the file name (they are all numeric).
    Insert this into the #-property of the file.

    I have no idea where to start. Can someone please help me?

    Jozi

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,371

    Re: File properties

    I understand the first 2 requirements:
    Quote Originally Posted by Jozi68 View Post
    Take all files in a certain folder.
    Take the first 4 characters of the file name (they are all numeric).
    That is as simple as this:
    Code:
    'Loop through each file in a folder
    For Each file As IO.FileInfo In New IO.DirectoryInfo("MyDirectory").GetFiles()
        'Get the first 4 characters of the file name
        Dim number As String = file.Name.Substring(0, 4)
    
    Next
    What I don't understand is your last requirement:
    Quote Originally Posted by Jozi68 View Post
    Insert this into the #-property of the file.
    Could you elaborate on that last requirement?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2008
    Posts
    21

    Re: File properties

    The #-Property is mostly used for music (I think), to indicate the order in which mp3 files need to be played.
    Name:  Windows Explorer Capture.jpg
Views: 122
Size:  9.0 KB
    I hope this helps, I'm not very good at explaining things.
    Thank you for your help, I have not coded in about 5 years, so I need to relearn everything.

  4. #4
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,562

    Re: File properties

    I was going to ask the same question as dday9. This is an interesting problem. I found some code samples and tried them and while I can read the properties of an mp3 file I haven't been able to find anything that writes them successfully. However, I'd rather not download anything (like a DLL) I don't really need to do my own work, so maybe some of the sites would be useful to you if you took them further. Also, if I'm able to change the property as a user I shouldn't really need any extra DLL; everything a .net program would need should already be in my PC...

    You might have to find out if it's a ID3v1 tag or a ID3v2 tag so you are trying the right code.

    So I suggest googling "change # property mp3 vb.net" or something similar. Sorry I can't be of more help. I would've liked to see my code work!
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  5. #5
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: File properties

    That's an ID3 tag specifically for mp3 files, it's located in the file header, and editing them from .NET is actually fairly difficult. Your best bet is to look for a tutorial by searching for something like "ID3 tags VB .NET". You'll probably get even better results if you search for "ID3 tags C#", but a lot of people don't want to see C#, as if it will give them a rash.

    Now, in the Windows App or whatever they call it platform, there's some stuff to manipulate these if I remember right. But you can't use them from a plain old Desktop app.
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

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