move() not work when dest name not provided
See original GitHub issueAs I’ve been working on moveSync
function, I noticed something about how the move
function does its job. I’d like this to be clarified for myself since I want the moveSync
to be consistent with move
.
When you do something like,
const fs = require('fs-extra')
fs.move('./source/somefile.txt', './source/otherDir/somefile.txt', callback)
it works just fine.
But, when you do like,
const fs = require('fs-extra')
fs.move('./source/somefile.txt', './source/otherDir', callback)
nothing happens.
However, if you run the same examples using Linux mv
command on a Terminal, the move operation occurs.
Is this an expected behavior from move
function?
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
moving items not working when filenames that have chars [ ]
Just using -literalpath parameter for move-item ls j:\ | foreach { $itemName = $_.Name.Replace('.', ' ') $destination = ls | where { $itemName...
Read more >move_uploaded_file - Manual - PHP
This function checks to ensure that the file designated by from is a valid upload file (meaning that it was uploaded via PHP's...
Read more >shutil — High-level file operations — Python 3.11.1 ...
filename is the full path of the archive. extract_dir is the name of the target directory where the archive is unpacked. If not...
Read more >"Access Denied" or other errors when you access or work with ...
Issue 1: I receive an "Access Denied" error message when I try to access or work with files and folders · Press and...
Read more >How to Change Nameservers and Point to Another Provider
By following our guide, your domain will work with your new hosting ... However, your domain name stayed with the old hosting company,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s right. I tested it just right now. It throws an EEXIST error. Also,
I tested for all these cases too and for all them it throws an EEXIST error.
It’s a common misconception that functions in
fs-extra
should behave like their Unix counterparts. I understand that because the introduction in the README discusses the Unix counterparts. However, I believe that we as programmers should make our intentions explicit as writing code is easy but going back and reading code is hard.explicit: (GOOD)
implicit: (NOT GOOD)
This not working is the expected behavior. However, it really shouldn’t silently fail. It should probably throw an
EEXIST
error.What are your thoughts @RyanZim?