Check .pc-trash_bin date stored times for target protection
With Peer Global File Service, you can enable target protection on a file collaboration, file replication, or file synchronization job. If this is done, when the file is modified on one of the participants, a copy of the file will be stored in the .pc-trash_bin folder on the remaining participants. Peer Global File Service will keep as many copies as are specified in the job's target protection options.
Some customers have asked to see the timestamp of when the files were added to the .pc-trash_bin folder. This data is stored in an alternate data stream called ~pc.TrashBinDate and is stored as a number of milliseconds from the Linux epoch (01/01/1970). You can use a PowerShell command to show the contents of any .pc-trash_bin folder and the date/time that the files were added to the trash bin.
Step-by-step guide
Open PowerShell:
- Open the Start menu.
- Type powershell and press Enter.
Copy and paste the following script into the PowerShell window:
POWERSHELLGet-ChildItem -path e:\test\.pc-trash_bin | ForEach-Object {$cFileTime=@(); $FileTime=@(); $aFound=@()} {$FileTime=(Get-Content -Path ./$_ -Stream '~pc.TrashBinDate').Split("|")[1]; $epoch=Get-Date -Date "01/01/1970"; $cFileTime=$epoch.AddMilliseconds($FileTime) ; $Properties = @{FileName=$_.Fullname; "Date Stored"=$cFileTime}; $NewObject = New-Object PSObject -Property $Properties; $aFound+=$NewObject } {$aFound | ft -Property Filename, "Date Stored"}
- Replace the e:\test\.pc-trash_bin entry with the path to the .pc-trash_bin folder you want to view the contents of.
- Press Enter.
Output similar to below will be displayed:
FileName Date Stored
-------- ----------
E:\test\.pc-trash_bin\uno - Copy.xlsx 12/17/2015 3:56:05 PM
E:\test\.pc-trash_bin\uno.xlsx 12/17/2015 7:20:57 PM
E:\test\.pc-trash_bin\uno.xlsx~pc-ver.1 12/17/2015 2:23:27 PM If you'd like to export this to a text file, modify the script as follows:
POWERSHELLGet-ChildItem -path e:\test\.pc-trash_bin | ForEach-Object {$cFileTime=@(); $FileTime=@(); $aFound=@()} {$FileTime=(Get-Content -Path ./$_ -Stream '~pc.TrashBinDate').Split("|")[1]; $epoch=Get-Date -Date "01/01/1970"; $cFileTime=$epoch.AddMilliseconds($FileTime) ; $Properties = @{FileName=$_.Fullname; "Date Stored"=$cFileTime}; $NewObject = New-Object PSObject -Property $Properties; $aFound+=$NewObject } {$aFound | ft -Property Filename, "Date Stored"} | Out-file -FilePath c:\temp\out.txt -Encoding ascii
Make sure to point the c:\temp\out.txt file at a directory that exists so the file can be created.