3

Using smbclient and the 'get' command to move files from a Windows network share over to a Linux box. I can smbclient from Linux to the network share and bring individual files over by doing something like:

smb: \Source\> get 'filename.txt'

This automatically drops the file into whatever current directory I'm in on Linux - which is perfect.

My question is: How do I stage a bunch of files on the network share, and then when I'm ready, transfer all of the files at once?

Hoping I don't have to name every individual file I want to transfer.

αғsнιη
  • 40,939
  • 15
  • 71
  • 114
Shroom
  • 31
  • 2
  • I'd recommend putting the `get` command in a code block (select it in the editor and click the `{}` button). Also it may improve readability by moving the question to the end. – James Risner Dec 22 '22 at 00:54

1 Answers1

1

In smbclient's built-in special purpose shell,

recurse ON
mget *

will recursively get all files.

Note that there's no real reason to memorize the slightly awkwardish smbclient commands; you can just mount the share and copy files from there as if they were on a local storage medium. Then, you can work without smbclient, but simply cp -r /point/where/you/mounted/the/share/* ./ to copy all files from there to the current directory.

Marcus Müller
  • 21,602
  • 2
  • 39
  • 54
  • If using the smbclient commands, the `mask` command can also be used in combination with `recurse` and `mget` to provide additional filtering control during recursive operations, as explained in detail in `man smbclient`. – David Yockey Dec 22 '22 at 00:07
  • Thanks all, this is what I need. I'm trying to mirror what I'd see in the field so I will go the mounting route. Next up, how to mount a share on Linux! – Shroom Dec 22 '22 at 00:58