I have a script I run from Windows Powershell and it can update a files modified, and last accessed timestamps. I run the script from a Windows 7 laptop but it can update file timestamps that reside on an ext4 filesystem on a network attached USB drive formatted as ext4.
Here is the script...
$filePath = "D:\Computing\Powershell\datetest\1TB_1.csv"
$csv = Import-Csv -Path $filePath #-Delimiter "`t"
foreach($row in $csv)
{
"Path = $($row.FullName) and Create_TS = $($row.CreatedDateUtc) and Modified_TS = $($row.ModifiedDateUtc) and Accessed_TS = $($row.AccessedDateUtc)"
$item = Get-Item $($row.FullName)
$item.CreationTimeUtc = $(Get-Date $($row.CreatedDateUtc))
$item.LastWriteTimeUtc = $(Get-Date $($row.ModifiedDateUtc))
$item.LastAccessTimeUtc = $(Get-Date $($row.AccessedDateUtc))
}
The .csv contains four columns: File Path; Create_timestamp; Modified_timestamp; LastAccessed_timestamp When I run the above script it updates the timestamps of files in the specified file path with the timestamps in that rows corresponding timestamp cells.
From testing it seems to work however I just realized that trying to update a Create_timestamp for these files doesn't take the Create_timestamp value in the .csv file but instead it will become the earlier of the modified and accessed timestamps from the .csv file
Is this just how it is with files on ext4 file systems or is there a way to update their create timestamps?
debugfs
for Windows. – Artem S. Tashkinov Jun 29 '20 at 09:32