Updating SetDirectory code written in version 5.2 to version 9

Hello,
I have a notebook written by a past student with Mathematica version 5.2 which I am trying to update to run in Mathematica 9. This is what I am having trouble with:

<< Calculus`FourierTransform`
SetDirectory[ToFileName[
   Extract["FileName" /. NotebookInformation[EvaluationNotebook[]],
    {1}, FrontEnd`FileName
    ]]];

I believe I can remove “Calculus`FourierTransform`”, as that package is now built-in, correct?
I tried replacing ToFileName with FileNameJoin but I still receive the error:

Extract::partd: "Part specification {1} is longer than depth of object.
SetDirectory::fstr: "File specification \!\(FileNameJoin[Extract[\"FileName\", {1}, FrontEnd`FileName]]\) is not a string of one or more characters.

Admittedly, I am a “beginner” at using Mathematica, and I hope these questions are not extremely simple.

Thanks for any help!

It should still work with ToFileName, but a simpler way to do the same in more recent versions is

SetDirectory[DirectoryName[NotebookFileName[]]]

The notebook does need to be saved to a file first.

Ok, thanks!
Now, if I understand it correctly, this part of code is setting the working directory to the directory of the notebook’s file name?
So I’m assuming somewhere later in the code it will call another notebook from the same directory?

Or even more simple:

SetDirectory[NotebookDirectory[]]

Good catch, that’s much nicer!

@Grant, yes, I would think that the directory is being changed with the intent of reading (or writing) a file in that location.