bchelli / node-smb2

SMB2 Client
123 stars 101 forks source link

Mkdir not working ? #49

Open san-slysz opened 2 years ago

san-slysz commented 2 years ago

I have been trying to use smb2 to create a new folder on remote. I am not sure what 'path' is suppose to hold (absolute path on share, relative path to share, ...)

Imagine this

  const smb2Client = new SMB2({
    share:'\\\\ip.ip.ip.ip\\c$\\shareFolder',
    domain:'ME',
    username:'my',
    password:'1234'
  });

Then if I want to create 'plop' under 'shareFolder' what should I wrote? I tried smb2Client.mkdir('plop' smb2Client.mkdir('.\plop' smb2Client.mkdir('.\\plop' smb2Client.mkdir('\\\\ip.ip.ip.ip\\c$\\shareFolder\\plop'

None seems to work. Could you tell me if I'm doing this wrong?

san-slysz commented 2 years ago

Considering an existing hello folder, with a.txt in it

// This works

smb2Client.readFile('hello\\a.txt', function(err, data){
  if(err) throw err;
  console.log(data);
});

// This doesn't

smb2Client.mkdir('hello\\plop', function (err) {
  if(err) throw err;
   console.log('Folder created!');
});