Simple Rename of File from a DOS shell
 I am simply attempting to rename a folder of files.  I want to remove a prefix.  The prefix for example is "XX-".  I have tried a simple rename and an xcopy.  If I use Ren XX-*.pdf *.pdf it does nothing.  I tried Ren XX-C*.pdf C*.pdf and still nothing.  If I try Ren XX-C*.pdf CCCC*.pdf that works.  I don't want to add the additional CCC's.  I really just want to remove the "XX-" from all files in the folder.  Any suggestions that will work?
August 25th, 2015 1:20pm

This is a Powershell scripting forum not a batch forum, you may want to search for the correct forum, if you want to use batch.
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 1:22pm

Clayman is correct, you want to post in the forum for the OS you are using.
August 25th, 2015 1:25pm

A PowerShell answer to this would be:

$Folder = 'C:\some\folder'
Get-ChildItem $Folder -Filter XX-*.* | % { $_ | Rename-Item -NewName ($_.Name -replace 'XX-','') }

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 1:32pm

A PowerShell answer to this would be:

$Folder = 'C:\some\folder'
Get-ChildItem $Folder -Filter XX-*.* | % { $_ | Rename-Item -NewName ($_.Name -replace 'XX-','') }

August 25th, 2015 5:27pm

In CMD shell scripts we rename folder s with the MOVE command.

HELP MOVE

https://technet.microsoft.com/en-us/library/Bb490935.aspx?f=255&MSPPError=-2147217396

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2015 11:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics