Stored Procedures doing File Manipulation doesnt sound like a good idea!
Maybe you can explain the scenario in more detail that might help people suggest maybe a better way out.
However, if you HAVE TO, i think you should look at CLR Stored Procedures in SQL Server.
That way, you can do the file manipulation using regular .NET classes
Refer these MSDN Link 1 and MSDN Link 2 links for more details
This particular link is related to permissions that need to be given to the assembly for it to be able to access external resources like files from a CLR procedure in SQL Server