2

I have a folder tree in my linux /home looking like this:

folder/
folder/folder1/
folder/folder1/file1.csv
folder/folder1/file2.csv
folder/folder2/
folder/folder2/file3.csv
folder/folder3/file4.csv

I am now looping over each csv file and want to use smbclient to put the files on a windows file share. On the destination, the folder1, folder2 file tree doesn't exist.

I tried

smbclient //server/data --command="cd path/to/destination; put /home/folder/folder1/file1.csv folder/folder1/file1.csv"

and get an

NT_STATUS_OBJECT_PATH_NOT_FOUND opening remote file \path\to\destination\folder\folder1\file1.csv

error because the file tree doesn't exist so far. I further tried

smbclient //server/data --command="cd path/to/destination; mkdir folder/folder1"

to create the folders before but get

NT_STATUS_OBJECT_PATH_NOT_FOUND making remote directory \path\to\destination\folder\folder1

since the smbcliend mkdir seems not to create also parent directories.

Is there an option in smbclient to check for existing parent directories and create them, if necessary, like the linux mkdir --parents option?

3
  • Can't you mount the share as CIFS?
    – Tom Yan
    Commented Jun 24, 2021 at 11:12
  • @Tom Yan unfortunately I am not the admin for the shared folder and cannot change mount settings there. Commented Jun 24, 2021 at 11:14
  • 1
    @gehbiszumeis: "mount settings" are a client-side thing - the actual shared folder isn't going to know whether you're accessing it via smbclient or via mount -t smb3 or via GVFS or something else.
    – grawity
    Commented Jun 24, 2021 at 11:16

0

You must log in to answer this question.

Browse other questions tagged .