Rename file using file's Date modified - VisualCron - Forum

Community forum

dlemley
2012-03-06T18:34:55Z
I receive .htm files VIA email. I save them to a particular directory. When saved they show a “Date created” entry and a “Date modified” entry.

I want to have Visual Cron rename the file using the "Date modified".

So for example, if I place a file in the directory and it looks like this:

Name - Date created - Date modified
eml_18556.htm - 3/6/2012 - 2/17/2012

I want to rename the eml_18556.htm file to 2012_02_17.htm
Support
2012-03-06T18:36:32Z
You can use the .NET code Task with this code:

using System;
using System.IO;

public class Test
{
 public static string GetModifiedDate(string strFilePath)
 {
     return File.GetLastWriteTime(strFilePath).ToString("yyyy_MM_dd");
 }
}

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top