Skip to content

databricks fs cp does not detect trailing slashes for file copy #2835

Open
@shreyas-goenka

Description

@shreyas-goenka

Describe the issue

The following command should fail with a directory does not exist error:

databricks fs cp hello.txt dbfs:/Volumes/a/b/mydir/

if directory mydir does not exist. This would be consistent with how the Linux cp works.

% cp 0.json tmp/
cp: directory tmp does not exist

Instead, this command creates a file called mydir with the contents of hello.txt.

Another option is to transparently create mydir. The Files API has the behaviour that it is supposed to create directories that don’t exist when uploading a file.

The cp should differentiate between whether the target is a file or a directory based on the trailing slash.

Is this a regression?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions