• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

change date created to date modified

x_kzy_xd

Member
I have a bunch of video files whose date created I need to change to date modified. They are scattered throughout my hard drive. Their extensions are .avi, .mp4, .mov, and .mts.


Is there some batch script I can use to do this?
 
That's a very, very unusual request. I don't think there are any programs out there that can do that.

The closest pre-existing tool I can think of that can accomplish this is timeclone, if you use the export feature to export the timestamps of everything in a directory tree (or even a drive), and then edit that exported timestamp file in a text editor--first use something like grep to filter only the files you want and then replace all the creation timestamps with the modification timestamps (something like Notepad2's block selection, copy, and paste can be used to make short work of that), and then use the import function to apply those modified timestamps.

But, really, for something like this, the best way to go is to write your own custom utility. Fortunately, what you want to do is pretty simple to whip up. For example, here's a bare-bones (no error checking, no feedback, etc.) C program that will replace a file's access and creation stamps with its modification stamp.
Code:
#include <windows.h>

#pragma comment(linker, "/entry:SyncToModifiedTime")
void SyncToModifiedTime( )
{
	UINT argc;
	PWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);

	if (argv && argc == 2)
	{
		HANDLE hFile = CreateFileW(
			argv[1],
			FILE_WRITE_ATTRIBUTES,
			FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
			NULL,
			OPEN_EXISTING,
			FILE_FLAG_BACKUP_SEMANTICS,
			NULL
		);

		if (hFile != INVALID_HANDLE_VALUE)
		{
			FILETIME ftCreationTime, ftLastAccessTime, ftLastWriteTime;

			if (GetFileTime(hFile, &ftCreationTime, &ftLastAccessTime, &ftLastWriteTime))
				SetFileTime(hFile, &ftLastWriteTime, &ftLastWriteTime, &ftLastWriteTime);

			CloseHandle(hFile);
		}
	}

	LocalFree(argv);
	ExitProcess(0);
}
 
Last edited:
Back
Top