Skip to content

cp commands in i18n tutorial create duplicate file (recursing AND globbing) #11158

Open
@smallsaucepan

Description

@smallsaucepan

Have you read the Contributing Guidelines on issues?

Description

Running through the i18n tutorial the cp commands under "Translate Markdown Files" were giving unexpected results.

cp -r docs/** i18n/fr/docusaurus-plugin-content-docs/current

In some shells, mine included, this leads to duplicate files because the shell globs all the files in all the subdirectories first and then recursively copies each one individually to the destination. So I end up with

api/file1.md
type/file2.md
file1.md
file2.md

Suspect globbing is used at all because in a later command we only want to include md and mdx files, so straight recursion would be too blunt an instrument:

cp -r src/pages/**.md i18n/fr/docusaurus-plugin-content-pages

Realise these commands are probably meant to be as simple as possible, though they could cause confusion for someone who doesn't twig to -r and ** doing similar things. Would like to hear any thoughts before suggesting a PR to fix. Would it be better to:

  1. change the commands to only use recursion OR globbing if possible
  2. use other utilities like find or cpio which may look more daunting but work more predictably
  3. add a warning message and link to more info "if you see duplicate files in the destination directory"

Self-service

  • I'd be willing to address this documentation request myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThe issue is related to the documentation of Docusaurus

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions