React-native-fs: EISDIR: illegal operation on a directory, read while using copyFile method

Created on 23 Oct 2019  路  2Comments  路  Source: itinance/react-native-fs

I'm trying simple code to copy a file to another external folder using this code:
RNFS.copyFile(sourcePath, destinationPath) .then(result => { console.log('file copied:', result); }) .catch(err => { console.log('error: ', err.message, err.code); });
and i have already granted Android.Permission for read and write in external directory but it's still returning this error:

error: EISDIR: illegal operation on a directory, read '/storage/emulated/0/' EISDIR
here are the dependency:

"react": "16.9.0", "react-native": "0.61.2", "react-native-fs": "^2.15.2"
Thanks for help in advance

Most helpful comment

I have resolved this issue, It was silly mistake. I forgot to mention name of the file in destination path url:

let destinationPath = statusDirPath +"/"+ this.props.media.name;
      RNFS.copyFile(sourcePath, destinationPath)  
        .then(result => {  
          console.log('file copied:', result);
        })
        .catch(err => {
          console.log(err);
        });

All 2 comments

I have resolved this issue, It was silly mistake. I forgot to mention name of the file in destination path url:

let destinationPath = statusDirPath +"/"+ this.props.media.name;
      RNFS.copyFile(sourcePath, destinationPath)  
        .then(result => {  
          console.log('file copied:', result);
        })
        .catch(err => {
          console.log(err);
        });

@thisisirfan
I have a similar problem with you, but I don't think it is a file name problem, because I have named each file.
https://github.com/itinance/react-native-fs/issues/979#issue-804042154

Was this page helpful?
0 / 5 - 0 ratings

Related issues

npomfret picture npomfret  路  4Comments

crobinson42 picture crobinson42  路  4Comments

onzag picture onzag  路  3Comments

AgNm picture AgNm  路  4Comments

ToJen picture ToJen  路  4Comments