0

We have a web service that creates a folder structure for our projects and as part of the this I need to create a text file that has the path to the project. I've created a template text file with a dummy path that I will replace when creating the file. e.g

//XXXXXXXX/projects/

Now the question is, what is the optimal way to create the file on a network share from my template and update the path? I think I have two options:

  1. open template file, get content as a string, replace the xxxxxxxx and then create a new text file on the network share

  2. copy the template file to the network share, open, get the content as a string, replace the xxxxxxxx and save back

2
  • Why do you need to create a template file? If the file only has the project path, you can create a new text file after creating the directories. Commented Jan 20, 2014 at 10:34
  • @Kami the file actually has more than just the path but its not relevant to the question. I need to either copy or write a file as stated Commented Jan 20, 2014 at 10:46

1 Answer 1

2

I think this question is primarily opinion-based, but here goes:

I'd go for option #1, simply because (a) the two options are not that different and do not pose any significantly different technical "challenges", and (b) with option #1 you never run into the problem of having a file that points to an illegal path.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.