I need to rename over 100 folders.<\/p>\n

Advertisement

Currently the folder names include a comma. for example:<\/p>\n

Advertisement

Week1, Monday<\/strong><\/p>\n

I need to rename this to:<\/p>\n

Week1 Monday<\/strong><\/p>\n

I just simply need to remove the comma.<\/p>\n

I’d like to be able to do this in Powershell if possible, but any way will be great.<\/p>\n

I’ve tried a few things, but I’m not getting anywhere.<\/p>\n

Thanks for any help.<\/p>","upvoteCount":9,"answerCount":8,"datePublished":"2023-07-02T23:51:34.000Z","author":{"@type":"Person","name":"mattwestern","url":"https://community.spiceworks.com/u/mattwestern"},"suggestedAnswer":[{"@type":"Answer","text":"

I need to rename over 100 folders.<\/p>\n

Currently the folder names include a comma. for example:<\/p>\n

Week1, Monday<\/strong><\/p>\n

I need to rename this to:<\/p>\n

Week1 Monday<\/strong><\/p>\n

I just simply need to remove the comma.<\/p>\n

I’d like to be able to do this in Powershell if possible, but any way will be great.<\/p>\n

I’ve tried a few things, but I’m not getting anywhere.<\/p>\n

Thanks for any help.<\/p>","upvoteCount":9,"datePublished":"2023-07-02T23:51:34.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/1","author":{"@type":"Person","name":"mattwestern","url":"https://community.spiceworks.com/u/mattwestern"}},{"@type":"Answer","text":"

This should help:<\/p>\n

Remove commas from folder names - PowerShell - Spiceworks<\/p>\n

Remove-commas-from-folder-names<\/a><\/p>","upvoteCount":0,"datePublished":"2023-07-03T00:12:24.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/2","author":{"@type":"Person","name":"dwendel","url":"https://community.spiceworks.com/u/dwendel"}},{"@type":"Answer","text":"

\n
\n
<\/div>\n\"\" 10G:<\/div>\n
\n

I’ve tried a few things, but I’m not getting anywhere.<\/p>\n<\/blockquote>\n<\/aside>\n

Have what you tried where are you stuck?<\/p>\n

\n
\n
<\/div>\n \"\"\n PLEASE READ BEFORE POSTING! Read if you're new to the PowerShell forum!<\/a> Programming & Development<\/span><\/span><\/a>\n <\/div>\n
\n Hi, and welcome to the PowerShell forum! \n\n\nDon’t apologize for being a “noob” or “newbie” or “n00b.” There’s just no need – nobody will think you’re stupid, and the forums are all about asking questions. Just ask!\nUse a descriptive subject. Don't say \"Need help\" or \"PowerShell Help\", actually summarize what the problem is. It helps the rest of us keep track of which problem is which.\nDon’t post massive scripts. We’re all volunteers and we don’t have time to read all that, nor will we copy, past…\n <\/blockquote>\n<\/aside>\n","upvoteCount":0,"datePublished":"2023-07-03T03:47:45.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/3","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}},{"@type":"Answer","text":"

Have you looked at the PowerRename feature of Microsoft PowerToys?<\/p>\n

It maybe able to do what you are looking to do.<\/p>","upvoteCount":0,"datePublished":"2023-07-03T08:32:27.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/4","author":{"@type":"Person","name":"cooperjs1","url":"https://community.spiceworks.com/u/cooperjs1"}},{"@type":"Answer","text":"

I use this quite a lot. I use it on files but it says it will do folders as well.<\/p>\n

\n
\n \n\n bulkrenameutility.co.uk<\/a>\n <\/header>\n\n
\n \n\n

Bulk Rename Utility - Free File Renaming Software<\/a><\/h3>\n\n

Bulk Rename Utility: Free File Rename Utility for Windows. Bulk Rename Utility allows you to easily batch rename files and folders based upon many flexible criteria. Free Download.<\/p>\n\n\n <\/article>\n\n

\n \n \n <\/div>\n\n
<\/div>\n<\/aside>\n","upvoteCount":2,"datePublished":"2023-07-03T11:16:23.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/5","author":{"@type":"Person","name":"graham3827","url":"https://community.spiceworks.com/u/graham3827"}},{"@type":"Answer","text":"

I agree, PowerShell all the way…<\/p>\n

\n
\n\n learn.microsoft.com<\/a>\n <\/header>\n\n
\n \n\n

Get-ChildItem (Microsoft.PowerShell.Management) - PowerShell<\/a><\/h3>\n\n

The Get-ChildItem cmdlet gets the items in one or more specified locations. If the item is a container, it gets the items inside the container, known as child items. You can use the Recurse parameter to get items in all child containers and use the...<\/p>\n\n\n <\/article>\n\n

\n \n \n <\/div>\n\n
<\/div>\n<\/aside>\n\n
\n
\n\n learn.microsoft.com<\/a>\n <\/header>\n\n
\n \n\n

ForEach-Object (Microsoft.PowerShell.Core) - PowerShell<\/a><\/h3>\n\n

The ForEach-Object cmdlet performs an operation on each item in a collection of input objects. The input objects can be piped to the cmdlet or specified using the InputObject parameter. Starting in Windows PowerShell 3.0, there are two different ways...<\/p>\n\n\n <\/article>\n\n

\n \n \n <\/div>\n\n
<\/div>\n<\/aside>\n\n

https://ss64.com/ps/replace.html<\/a><\/p>\n

#Get all the sub directories of the main\nGet-ChildItem -Path C:\\Temp -Directory | ForEach-Object {\n   #do something with each directory.\n   Rename-Item $_.FullName -NewName $_.FullName.Replace(\",\",\"\")\n}\n<\/code><\/pre>\n

From there you can use any variation of string manipulation to get the desired output, in this example I just removed the “,”, but you could add formatted dates, make decisions based on directory name, etc…<\/p>","upvoteCount":1,"datePublished":"2023-07-03T12:43:08.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/6","author":{"@type":"Person","name":"foo","url":"https://community.spiceworks.com/u/foo"}},{"@type":"Answer","text":"

\n
\n
<\/div>\n\"\" Graham1988:<\/div>\n
\n

I use this quite a lot. I use it on files but it says it will do folders as well.<\/p>\n

https://www.bulkrenameutility.co.uk/<\/a><\/p>\n<\/blockquote>\n<\/aside>\n

up for bulk rename too…<\/p>\n

just untick “files” and it work for folders<\/p>","upvoteCount":0,"datePublished":"2023-07-03T13:09:15.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/7","author":{"@type":"Person","name":"adrian_ych","url":"https://community.spiceworks.com/u/adrian_ych"}},{"@type":"Answer","text":"

Thanks everyone, I appreciate the help, I’ll check all the suggestions out, much appreciated.<\/p>","upvoteCount":0,"datePublished":"2023-07-03T21:22:39.000Z","url":"https://community.spiceworks.com/t/batch-rename-folders-how/954826/8","author":{"@type":"Person","name":"mattwestern","url":"https://community.spiceworks.com/u/mattwestern"}}]}}