All Products
Search
Document Center

Object Storage Service:ossfs 2.0 file and folder detection mechanism

Last Updated:Dec 18, 2025

This topic describes how ossfs 2.0 detects files and folders in an Object Storage Service (OSS) bucket.

Core differences between object storage and traditional storage

Object storage uses a flat address space to store data, unlike the hierarchical folder structure of traditional file systems. The core differences are as follows:

  • No hierarchical association: OSS buckets do not have the concept of files and folders. All data is stored as objects.

  • Differences in naming conventions:

    • Traditional file system: A file named 'a' and a folder named 'a/' cannot exist in the same folder.

    • Object storage: 'a' and 'a/' are two independent objects. They can coexist and have no logical association.

ossfs 2.0 file system simulation mechanism

When you mount an OSS bucket using ossfs 2.0, ossfs simulates a file system as follows.

  • Folder tree construction: It uses the forward slash (/) as a path separator to build a virtual folder structure based on object names.

  • Detection logic: It infers the object type (file or folder) by analyzing the / separator in the object name and the relationships between sub-objects.

Object detection principles

Important

If you use tools such as ossfs 1.0 and ossfs 2.0 or products such as Cloud Storage Gateway (CSG) to mount an OSS bucket, follow file system naming conventions when you create objects in the bucket. Do not create objects with names that differ only by a trailing forward slash, such as a and a/.

Scenario

Detection result

Condition or logic

The bucket contains only the object a.

File

A single object without a trailing / is considered a file by default.

The bucket contains only the object a/.

Folder

An object name that ends with / is considered a virtual folder.

The bucket contains the object a/b, but not a or a/.

Folder

The parent a is inferred as a virtual folder from the sub-object path a/b.

The bucket contains both the object a and the object a/.

Undefined behavior

The object naming in the bucket does not follow file system conventions.

The bucket contains the objects a and a/b, but not a/.

Undefined behavior

The object naming in the bucket does not follow file system conventions.