1

I am using windows server 2016 and I am facing a problem. We have been making some changes and I am now in need of having a folder that whenever a file(in this case a specific type (.msg)) is placed inside the folder the file has to be renamed with a sufix or prefix, like day hour minute or even second or XXXX random name.

Do you know if this is possible and how?

Sorry if I am being ignorant..

Thank you in advance.

1

1 Answer 1

0

Many years ago I wrote a program that used a Windows API to track folder changes. Nowadays it looks as though this functionality is available through Powershell: https://mcpmag.com/articles/2015/09/24/changes-to-a-folder-using-powershell.aspx

Addendum: The procedure in the link above can still be used to trigger a rename operation when a file is written to the directory (as opposed to, for example, running a scheduled task.

The CMD way of adding a suffix before the file extension of the file is documented in the following post: https://superuser.com/questions/603958/add-text-to-end-of-filename-but-before-extension-using-batch-file#604285

Some quick web searching using these same terms gave the following answer for doing the same in PowerShell: https://social.technet.microsoft.com/Forums/sharepoint/en-US/50114a6b-1902-4a31-9c2f-0dbf015057c5/powershell-append-text-to-the-end-of-a-file-name-before-the-extension

1
  • I probably misinformed you guys, I want the files inside the folder to be renamed with a sufix or prefix , not to know when was renamed or anything like that :c Commented Apr 8, 2019 at 13:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.