AvianFlu / ncp

Asynchronous recursive file copying with Node.js.
MIT License
681 stars 103 forks source link

Copy all files from dir into subdir inside that dir #113

Open falconmick opened 7 years ago

falconmick commented 7 years ago

I don't know if this is a bug or just an example of misuse that you don't really care if it exists.

Today I decided to copy all files inside of docs/ into docs/scratch-list so that I could test my app inside of my local instance before I deploy to https://falconmick.github.io/scratch-list/

about 10 seconds later I realised that somthing bad was probably happening and stopped the process. By this time it had created a directory 23108 characters long comprimised of 1775 sub directories of scratch-list.

At this point windows decided to be as awesome as possible and tell me that the files located inside of it had too long a name to delete, so I had to use robocopy to copy the files into oblivion (stupid I know).

For now my solution is going to be copy to a tmp dir then back into the docs/ folder after the prior one completes, but should this even be a thing? My thoughts would be it would copy the current files in that directory at time of start, not continuously look for new files.

Cheers, Michael.

ribizli commented 6 years ago

I've got into this problem with fs-extra's copy. copy('folder', 'folder/folder') Actually I think it is a forbidden file operation on OS level:

> cp -r test/ test/
cp: recursion detected, omitting directory 'test/test'