Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Generate new path and append (number)

$
0
0

@Adam, I don't think you understand what I'm trying to accomplish. I'm automating a process, specifically in Word and auto filling out a form. I open a template and try to save the file to C:\Test\Test.doc, but the path exists because the process has already run. I want to 'increment' the path accordingly so when I call .SaveAs() then I'm passing a path so that the previous item does not get overwritten. So, when the script starts I'll have a function that takes the static C:\Test\Test.doc path and dynamically generate the next incremental file name (e.g.C:\Test\Test(1).doc). Your code just generates 10 incremented directories. If you try the code above, the first run it will generate text.txt and each successive run will generate a new path\item because the initial static path exists. I wasn't very clear in my post, but there was a cold Porter calling my name. :)


Viewing all articles
Browse latest Browse all 13067

Trending Articles