1

I at wits end trying to rename NTFS files that have technically legal, but problematic multiple periods in my Windows 2012 Server share

Files are dropped in a share that look like this:

THIS.IS.THE.FILE.NAME.20150102

THIS.IS.THE.FILE.NAME.20150103 (etc)

(Note: the date in the extension does not match the current date or anything like that.)

I would like to use Windows command shell end with files named simply like this:

20150102.CSV or FILE_20150102.CSV

20150103.CSV or FILE_20150103.CSV

I have tried various combinations of the rename command with various permutations of Asterisks * and/or ??? wildcards, with and without quotes. However, at most I end up deleting off the "extension" containing the date.

Ideally, there is a form of the rename command I just haven't used that can do the trick simply at the command prompt (or batch) without PowerShell.

However, if there is a complete explanation of a simple Powershell command/script I can use within Task Scheduler, I could give that a go. As noted, I am using Win Server 2012 (in its default config)

However, I am specifically unable to use any 3rd party executables, no matter how useful.

Thanks!

d.

dave_the_dev
  • 131
  • 3
  • This is a good learning opportunity to get started with Powershell. Is there anything you've tried yet that is giving you difficulty? – Clayton Jan 13 '15 at 16:54

1 Answers1

0

I think this answer should get you most of the way to what you need.

It covers getting the extension from each file and then doing a rename.

jas_raj
  • 437
  • 3
  • 6
  • No, it does not work with the complications of multiple periods, which is the heart of my issue. Basic complication is rename is plainly ugly through batch with multiple periods – dave_the_dev Jan 16 '15 at 00:44