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?