question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

copy and copySync: reallow copying to subdirectories

See original GitHub issue

In fs-extra 5.0.0, you fixed an issue that said that directories could be copied to their own subdirectories. This is wonderful, but I couldn’t help but notice that it would break some scripts. In some cases, one may want to copy a directory to its subdirectory, and use a filter function to prevent recursion. Perhaps you could give an option which is false by default that allows to copy to a subdirectory?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

3reactions
duhseekohcommented, May 1, 2018

With v5 this fails and I don’t quite follow the logic.

await fs.copy('db', 'build/db');

yields this error: Error: Cannot copy '/db/util' to a subdirectory of itself, '/build/db/util'

I’m copying db to build/db, not to a subdirectory of db (itself).

1reaction
vjprcommented, Jun 17, 2019

I saw this again in v8.0. Trying to copy a symlink over another symlink.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Copy folder recursively in Node.js - javascript - Stack Overflow
copySync & moveSync both will copy and move folders even if they have files or subfolders and ... Copies directory, even if it...
Read more >
10 Practical Examples of Rsync Command in Linux - Tecmint
Rsync is the most commonly used command for copying and synchronizing files and directories remotely as well as locally in Linux/Unix ...
Read more >
Sync Copy in fs-extra using NodeJS - Tutorialspoint
This method copies files or directories from one location to another location in a sync process. The directory can have sub-directories and ...
Read more >
Copy without creating folders - Help and Support - rclone forum
So what i want is: "rclone copy /path/folder/ remote:destination ... to be copied to remote:destination without creating the subfolder.
Read more >
Robocopy examples - 4sysops
Robocopy (Robust File Copy) is a command line folder and file ... /PURGE /E. /MIR also copies all files in subfolders, including empty...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found