in reply to How to extract the filenames in an array
It's also good to ask all of your related questions in one post. I see you asked a similar question in How do i take the first 4 characters of any file name in a specified directory?