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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.