TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

Hi Christian,

I have issue with the green overlay icon function for OneDrive files and folders. It shows some of the folders that are just available offline as being marked to be always kept on the device, and some other are not checked at all while being actually available offline. And separate files get checked only if they are marked as Always available offline in the Explore context menu. And there are mismatches with checkmarks against "Alwayskeep on this device" context menu item in TC and Explorer for same folders. Please see screenshot https://pasteboard.co/me9fYVEZhFhg.png

Regards,
Alex
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *ghisler(Author) »

The not filled green circle in Explorer means files which are available offline, but not marked as always available offline. TC shows these without any overlay. The filled green circle means that files/folders are marked as always available offline. It looks like the Explorer treats folders differently here. Can you check in these folders whether there any any files in them marked as "always keep offline"?
Author of Total Commander
https://www.ghisler.com
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

ghisler(Author) wrote: 2023-06-06, 13:38 UTC The not filled green circle in Explorer means files which are available offline, but not marked as always available offline. TC shows these without any overlay. The filled green circle means that files/folders are marked as always available offline. It looks like the Explorer treats folders differently here. Can you check in these folders whether there any any files in them marked as "always keep offline"?
I completely understand the logic behind how Explorer marks folders. But I can't see any logic behind checkmarks in TC. Let's take for example folders _Audio and _Soft. Please see links to screenshots below. I have files and folders with all kinds of settings in both folders: available offline, always available offline, and available only online. But _Audio folder has checkmark in TC, and _Soft folder does not.

https://pasteboard.co/B28w3S5HE6SQ.png
https://pasteboard.co/PMqi8bf0j5kD.png
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *ghisler(Author) »

Total commander shows the filled green circle icon when the file or folder has the flag FILE_ATTRIBUTE_PINNED set.
You can find the description of that attribute here:
https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
This attribute indicates user intent that the file or directory should be kept fully present locally even when not being actively accessed. This attribute is for use with hierarchical storage management software.
I don't know what the Explorer shows, maybe it looks inside the folder and shows the overlay when one or more files inside have the pinned attribute. The only information I have is the pinned attribute, nothing else.
Author of Total Commander
https://www.ghisler.com
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

ghisler(Author) wrote: 2023-06-07, 07:38 UTC Total commander shows the filled green circle icon when the file or folder has the flag FILE_ATTRIBUTE_PINNED set.
You can find the description of that attribute here:
https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
This attribute indicates user intent that the file or directory should be kept fully present locally even when not being actively accessed. This attribute is for use with hierarchical storage management software.
I don't know what the Explorer shows, maybe it looks inside the folder and shows the overlay when one or more files inside have the pinned attribute. The only information I have is the pinned attribute, nothing else.
I'm neither this much technically skilled to dig into files and folders technical flags, nor I have a wish to do so. I'm looking at things from ordinary user's point of view. And from this point of view the Explorer's behavior is totally correct and consistent. It only shows filled green circle when the folder is marked to be always kept on the device, or if every file and folder without exceptions in a given folder is marked to be always kept on the device. That is absolutely clear to me. If at least one file or folder contained in a given folder is not marked to be always kept on the device, and therefore does not have a filled green checkmark, then the given folder also does not have a filled checkmark.
But what the filled green circle means in TC is never clear as we can see on the screenshots from my previous post. Both mentioned folders, given as an example, contain files and folders with all kinds of availability attributes, but one of the two given folders has a green checkmark in TC and another does not.
I understand that there are technical limitations on Microsoft's part that prevent you from realizing the feature properly. But under these conditions it would be better to have an option to disable these green checkmarks comletely in TC settings until it's possible to deal with technical limitations.

Anyway, thank you for your efforts.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *ghisler(Author) »

It's possible that you right clicked on one of these folders and chose to always keep it offline, but didn't do this for the other folder, just for some files inside of it.
Author of Total Commander
https://www.ghisler.com
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

ghisler(Author) wrote: 2023-06-07, 13:09 UTC It's possible that you right clicked on one of these folders and chose to always keep it offline, but didn't do this for the other folder, just for some files inside of it.
I checked that. Neither of the two folders is chosen to be always kept offline.
https://pasteboard.co/UHKicL56lU76.png
https://pasteboard.co/G5UMbBXNXLog.png
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *ghisler(Author) »

Then there is no solution, sorry. All I have is this file/folder attribute, I don't have access to any other information the Explorer has.
Author of Total Commander
https://www.ghisler.com
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

ghisler(Author) wrote: 2023-06-11, 08:15 UTC Then there is no solution, sorry. All I have is this file/folder attribute, I don't have access to any other information the Explorer has.
Christian, I understand your limitations. But if TC's behavior in this case is based on the informaton it gets from the Explorer, then TC shouldn't have displayed the green circle checkmark for both folders in example, since both folders don't have "Always keep on this device" option enabled. It's obvious that TC is inconsistent in marking folders availability based on the Explorers info. It's ok that software doesn't always work as intended, but I kindly ask you to add to the settings an option to disable checkmarks, because now the feature gives confusing information on folders availability.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *ghisler(Author) »

No, it doesn't get any such information from the Explorer, it doesn't provide that information. Total Commander gets the attribute FILE_ATTRIBUTE_PINNED directly from reading the file system. In my own tests, this has been accurate.
Author of Total Commander
https://www.ghisler.com
User avatar
AntonyD
Power Member
Power Member
Posts: 1231
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *AntonyD »

2Alex1213
try this code:

Code: Select all

# Function to recursively get file attributes
function Get-FileAttributesRecursive($FolderPath) {
    $items = Get-ChildItem -Path $FolderPath -Force -Recurse

    foreach ($item in $items) {
        $attributes = $item.Attributes

        # Check if FILE_ATTRIBUTE_PINNED flag is set
        if (($attributes -band [System.IO.FileAttributes]::Pinned) -eq [System.IO.FileAttributes]::Pinned) {
            $isPinned = $true
        } else {
            $isPinned = $false
        }

        # Output the item's name and FILE_ATTRIBUTE_PINNED flag status
        Write-Output "$($item.FullName) - Pinned: $isPinned"
    }
}

# Check if the starting folder name is provided as a command-line argument
if ($args.Length -lt 1) {
    Write-Output "Please provide the starting folder name as a command-line argument."
    exit
}

# Get the starting folder name from the command-line argument
$startingFolder = $args[0]

# Call the function to get file attributes recursively
Get-FileAttributesRecursive $startingFolder
save it as "script.ps1" file anywhere & call it from command prompt:
powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\saved\script.ps1" "C:\path\to\starting\folder"

So you can provide Mr.Ghisler with exhaustive evidence of what all the elements of these two directories look like.
And then you can correlate his words that he only works with this flag with the way Explorer displays these directories.
#146217 personal license
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

AntonyD wrote: 2023-06-14, 10:10 UTC 2Alex1213
try this code:

Code: Select all

# Function to recursively get file attributes
function Get-FileAttributesRecursive($FolderPath) {
    $items = Get-ChildItem -Path $FolderPath -Force -Recurse

    foreach ($item in $items) {
        $attributes = $item.Attributes

        # Check if FILE_ATTRIBUTE_PINNED flag is set
        if (($attributes -band [System.IO.FileAttributes]::Pinned) -eq [System.IO.FileAttributes]::Pinned) {
            $isPinned = $true
        } else {
            $isPinned = $false
        }

        # Output the item's name and FILE_ATTRIBUTE_PINNED flag status
        Write-Output "$($item.FullName) - Pinned: $isPinned"
    }
}

# Check if the starting folder name is provided as a command-line argument
if ($args.Length -lt 1) {
    Write-Output "Please provide the starting folder name as a command-line argument."
    exit
}

# Get the starting folder name from the command-line argument
$startingFolder = $args[0]

# Call the function to get file attributes recursively
Get-FileAttributesRecursive $startingFolder
save it as "script.ps1" file anywhere & call it from command prompt:
powershell.exe -ExecutionPolicy Bypass -File "C:\path\to\saved\script.ps1" "C:\path\to\starting\folder"

So you can provide Mr.Ghisler with exhaustive evidence of what all the elements of these two directories look like.
And then you can correlate his words that he only works with this flag with the way Explorer displays these directories.
Thanks Antony. I ran the code on both folders from the above example and the FILE_ATTRIBUTE_PINNED flag status was FALSE for every single contained folder and file. I checked every sigle item. Below are screenshots of only small parts of the code's output.

https://pasteboard.co/NOD4vjiNjDyt.png
https://pasteboard.co/tz9c4cFT96UG.png

Nevertheless, one of the folders in the example does have the green checkmark and the other does not.
Alex1213
Junior Member
Junior Member
Posts: 7
Joined: 2023-06-06, 09:24 UTC

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *Alex1213 »

ghisler(Author) wrote: 2023-06-13, 21:17 UTC No, it doesn't get any such information from the Explorer, it doesn't provide that information. Total Commander gets the attribute FILE_ATTRIBUTE_PINNED directly from reading the file system. In my own tests, this has been accurate.
Unfortunately I'm not that tech-savvy to dig deeply into it. I'm just an ordinary user managing my files with TC and don't really want to investigate any technical attributes of files and folders. TC is a great product overall, but in this case, the way the function works is misleading and not consistent with the very logical way Windows Explorer behaves. Once again, I understand that some limitations may exist, although running the code, AntonyD provided above, on the mentioned folders showed the FALSE status of the FILE_ATTRIBUTE_PINNED flag of all files and folders inside both.
I just kindly ask for a possibility to disable the function in settings.
User avatar
AntonyD
Power Member
Power Member
Posts: 1231
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: TC 10.52 Incorrect behavior of the green overlay icon function for OneDrive files and folders

Post by *AntonyD »

2Alex1213
please replace string:
($attributes -band [System.IO.FileAttributes]::Pinned) -eq [System.IO.FileAttributes]::Pinned
with
($attributes -band [System.IO.FileAttributes]::Pinned) -ne 0
and retest all!

Looks like I copied the wrong code for you))) - remade it from another - but there was another logic.
Purely technically, it seems that this bitwise operation " -band " can really give a final number that can be compared with the flag itself.
But I always get confused in these operations, so it's more reliable to just compare with non-zero)))
And of course retest on some folder/file - which for 10000% should be pinned by OneDrive.
I mean - we definitely should see somewhere PINNED = TRUE, or this attributes does something different but not the same like Mr.Ghisler think about it.
#146217 personal license
Post Reply