How to copy from a windows network to a linux machine

Posted on


I need to create a batch that regularly copies a file file.txt from a windows remote machine (located at$) to a linux machine located at
The batch should run on the linux machine.
What is the simplest way to do it?


My guess is that the easiest is to:

Get Windows file sharing working.

Make sure you have the smbclient program on your Linux box. This is usually in a package called samba-client or similar.

Make a script, something like smbclient // -c 'get /file /dest/dir1'

Depending on what your permissions are, you may want to add an authentication file, name and password. so it would be smbclient -a smb_auth.txt // -c 'get /file /dest/dir1'

Schedule this in cron.

Note: This doesn’t match your requirements exactly

If you can go from Windows to linux instead of the reverse, you can use WinSCP and it’s ‘synchronize folders’ feature:

  1. Connect to the linux box using WinSCP
  2. Select: Commands –> Keep Remote Directory up to Date...

    File Menu showing Commands --> Keep Remote Directory up to Date…”></p>
<p>Set the parameters as needed</p>
<p><img decoding=

This will keep the remote directory up to date automatically for you. You can also use their scripting functionality to keep things updated.

Leave a Reply

Your email address will not be published. Required fields are marked *