question

chas8-9920 avatar image
0 Votes"
chas8-9920 asked chas8-9920 commented

rename (ren) cmd syntax error

(I wasn't sure which Tag to use for this question. If I used an inappropriate tag and you can tell me which one to use, I would appreciate it.)

I get a syntax error when trying to globally rename directories (i.e., folders) with names as in the example below; e.g., to globally change the "x" to a number, e.g., "2," These directories are contained in a sub-directory that is within my Documents, and these directories themselves have sub-directories inside of them.

The format of the command I've used (at the cmd prompt in the directory where these directories reside) is: ren " x" " 2". I also tried: ren " 202x" " 2022" and get the same "The syntax of the command is incorrect" error.

Any help will be appreciated! Thank you.

Example of directory (not file) names:

Apr 202x
Aug 202x
Dec 202x
Feb 202x
Jan 202x
July 202x
June 202x
Mar 202x
May 202x
Nov 202x
Oct 202x
Sep 202x

windows-forms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered chas8-9920 commented

The Tag is wrong (it is not related to Winforms)

You can rename folders with PowerShell, simpler than CMD commands :

 Get-ChildItem -Recurse -Filter *x* | Rename-Item -NewName { $_.name -replace 'x', '2'} 
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Worked great! Thank you for the help.

0 Votes 0 ·