// Assume we have a remote connection established // with the name "mydrive" // Get information about a file called "example.txt" info, err := fs.Stat(remote.NewPath("mydrive:/example.txt")) if err != nil { fmt.Println("Error:", err) } // Print the size of the file fmt.Println("File size:", info.Size)
// Assume we have a remote connection established // with the name "mydrive" // Check if a file called "example.txt" exists _, err := fs.Stat(remote.NewPath("mydrive:/example.txt")) // If the error is nil, the file exists if err == nil { fmt.Println("File exists") } else { fmt.Println("File does not exist") }These examples demonstrate the use of the ObjectInfo struct in the "github.com/ncw/rclone/fs" package to retrieve information about and check for the existence of objects in remote storage systems.