It's working except I forgot to mention something,
There is already a content inside the file, the script replace everything inside the file with the filename. I want to add it in the first line without replacing the content.
One more thing, I also want to exlude the extension.
message edited by sundaymelon