i tried it, but...
by davsam7 - 7/6/06 5:29 PM
In Reply to: AttributeMagic Pro by lgrunin
...the twenty file minimum was very annoying, and i didn't want to pay for a program to do a simple file attribute change.
so, to do what i wanted to do to my files (change the modified datetime to equal the created datetime) i did the following:
1. downloaded the free visual basic 2005 express edition from microsoft's msdn page and then installed it
2. fired it up and chose to create a new windows application
3. i place a button on the new form that's automatically created by double-clicking the button control on the toolbox. it's automatically named "Button1"
4. i double-click the button on the form and see the text "Public Class Form1" followed by a bit more that starts "Private Sub Button1_Click"
5. i select all the text and delete it. then i paste in the following text:
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProcessTree("e:\tunes")
End Sub
Private Sub ProcessTree(ByVal Dir As String)
Dim DirObj As New DirectoryInfo(Dir)
Dim Files As FileInfo() = DirObj.GetFiles("*.*")
Dim Dirs As DirectoryInfo() = DirObj.GetDirectories("*.*")
Dim Filename As FileInfo
For Each Filename In Files
Try
'*** THIS IS THE IMPORTANT BIT. THE NEXT LINE TELLS THE COMPUTER TO SET THE FILE'S LAST MODIFIED TIME TO BE EQUAL TO THE FILE'S CREATION TIME. THIS IS WHERE YOU CAN EXPERIMENT. SIMPLY TYPING "FILENAME." WILL BRING UP A LIST OF DIFFERENT FILE PROPERTIES, MOST OF WHICH CAN BE ALTERED ***
Filename.LastWriteTime = Filename.CreationTime
'*** END IMPORTANT BIT ***
Catch E As Exception
Console.WriteLine("Error changing attribute for {0}", Filename.FullName)
Console.WriteLine("Error: {0}", E.Message)
End Try
Next
Dim DirectoryName As DirectoryInfo
For Each DirectoryName In Dirs
Try
ProcessTree(DirectoryName.FullName)
Catch E As Exception
Console.WriteLine("Error accessing {0}", DirectoryName.FullName)
Console.WriteLine("Error: {0}", E.Message)
End Try
Next
End Sub
End Class
6. i then press F5. this starts the program. a window entitled "Form1" with a button with "Button1" on it appears.
7. i click the button. about ten seconds later all my mp3s have been updated and my winamp media library views work as i had intended.
i hope this will be of some use to people who might not want to pay for a program to do something that should be, and is, so free and easy. i realise this may be outside the scope of some, but i think that if you need to do a bulk replace of file information then you'll have no problem following the seven steps above.
HTH,
ez
Was this reply helpful? (0) (0)
Staff pick