Hello all,<\/p>\n
I have a script that create a folder with current date, i want to add something if the folder already exists I want to name it as foldername+old and if script run againit name the other folder as old 1 and so on.<\/p>\n
how can i do that.<\/p>\n
Thanks<\/p>","upvoteCount":4,"answerCount":5,"datePublished":"2021-10-25T13:23:35.000Z","author":{"@type":"Person","name":"tkr99","url":"https://community.spiceworks.com/u/tkr99"},"suggestedAnswer":[{"@type":"Answer","text":"
Hello all,<\/p>\n
I have a script that create a folder with current date, i want to add something if the folder already exists I want to name it as foldername+old and if script run againit name the other folder as old 1 and so on.<\/p>\n
how can i do that.<\/p>\n
Thanks<\/p>","upvoteCount":4,"datePublished":"2021-10-25T13:23:35.000Z","url":"https://community.spiceworks.com/t/powershell-to-add-versions-to-folder/814981/1","author":{"@type":"Person","name":"tkr99","url":"https://community.spiceworks.com/u/tkr99"}},{"@type":"Answer","text":"
what have you tried?<\/p>\n
‘test-path’ to see if it already exists<\/p>\n
‘rename-item’ to rename<\/p>\n
‘new-item’ to create a new folder<\/p>\n
give it a try<\/p>\n
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n