We report a new method to control both the nucleation and growth of highly porous polyaniline (PANI) nanofiber films using porous poly(styrene-block-2- vinylpyridine) diblock copolymer (PS-b-P2VP) films as templates. A micellar thin film composed of P2VP spheres within a PS matrix is prepared by spin coating a PS-b-P2VP micellar solution onto substrates. The P2VP domains are swollen in a selective solvent of acetic acid, which results in the formation of pores in the block copolymer film. PANI is then deposited onto the substrates modified with such a porous film using electrochemical methods. During the deposition, the nucleation and growth of PANI occur only at the pores of the block copolymer film. After the continued growth of PANI by the electrochemical deposition, a porous PANI nanofiber film is obtained.