Jump to content

Timestamp issue


Recommended Posts

Hi,

 

I've a issue modifying the timestamp of folders on Unraid. I've made a Powershell script tha scans the folder, and changes the folders timestamp to that of the oldest file. Everything is working fine when running it on a folder on my windows machine, however running it on a shared Samba folder doesn't work. The timestamp of the folder located on the Unraid server does not get updated.

 

I'm running a 5.0.5 version of Unraid

 

Any help appreciated

 

Powershell script:

$folders = Get-ChildItem $root | Where-Object {$_.PSIsContainer} | Sort Name

foreach($folder in $folders)

{

Write-Warning $folder.fullname

 

$oldest = Get-ChildItem -LiteralPath $folder -Force | Sort LastWriteTime | select -First 1

Write-Host $oldest

Write-Host $oldest.LastWriteTime

 

if($oldest)

{

#oldest object found, set current directory LastWriteTime

$Crea = Get-ItemProperty -Path $folder -Name CreationTime

$Last = Get-ItemProperty -Path $folder -Name LastWriteTime

Write-Host $Crea

Write-Host $Last

 

Set-ItemProperty -Path $folder -Name CreationTime -Value $oldest.LastWriteTime -force

Set-ItemProperty -Path $folder -Name LastWriteTime -Value $oldest.LastWriteTime -force

 

}

else

{

# current directory is empty, directory LastWriteTime is left unchanged

Write-Warning "Directory '$($folder.FullName)' is empty, skiping..."

$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

}

 

}

Write-Host

Write-Warning "Done..."

$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

 

Link to comment

Not sure you can expect something which works on Windows local files to work on SAMBA or Linux. Might need to do some more research about that.

 

Alternatively, you could probably write a bash script to do it at the unRAID command line.

 

 

Link to comment

But should it not be possible to change the timestamp on the files through Samba??

 

Unfortunately i don't know any Linux, nor any Bash.

Googling makes me think that you have to make some settings in samba to allow this, or that it might even be broken in samba.

 

Probably some googling would get you a bash script for what you want.

Link to comment

Hi,

 

I've a issue modifying the timestamp of folders on Unraid. I've made a Powershell script tha scans the folder, and changes the folders timestamp to that of the oldest file. Everything is working fine when running it on a folder on my windows machine, however running it on a shared Samba folder doesn't work. The timestamp of the folder located on the Unraid server does not get updated.

 

I'm running a 5.0.5 version of Unraid

 

Any help appreciated

 

Are you using user shares or disk shares?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...