Home Learn Linux Linux Answers Internet Need to write a script in a way that all the files in linux should be copied to windows machine
  • The most natural simple answer for you is use nfs.
    Here are two links that you can read to understand how to use nfs to share files :
    Once you have nfs set up, your shell script can be as trivial as :
    cp -r /home/anil/shared/somefolder /mnt/nfs/windows/shared/somefolder

    Doing anything more complex than that; such as checksumming or logging will only depend on your shell scripting skills.

    You could use rsync instead of nfs :
    but if you want the solution that ticks all of your boxes (If your data isn't sensitive, like private information, phone numbers, etc) It's git :
    easy to learn, easy to use, can be scripted, has user interfaces, logs as much as you want, stores everything using hashes to ensure data integrity and much more.
    If your data is sensitive then maybe use nfs or rsync along with strong passwords instead of git.

    There are actually multiple ways to do what you want to do and little short of actually writing the script for you, I'm sure one of the afore mentioned options will suit.

    Answered by Zanpaktou
    5 years ago
    1 0
  • Having a look on the nature of your question, I would recommend you to have a look on RSYNC. This is a file synchronization tool, which will handle the issue of copying only changed files.
    You can mount the windows partitions (using smbmount/mount -t smbfs) and use rsync from your script in order to keep synchronized the contents of your Linux folders and mounted windows folders. Rsync also provides you with incremental backup facility.

    Answered by tamas
    5 years ago
    0 0
  • Take a look at these two solutions:
    - SSHD
    Use an sshd server under windows (Cygwin does it fine), exchange ssh keys between two hosts and simple copy files or dirs by using scp commands

    - RSYNCD
    As well as sshd you can install an RSYNC server daemon, there are a lot of them (free/opensource/shareware/commercial/...). I prefer Cygwin builds in this case also.
    And use RSYNC for dir sync, it works without headaches and it's very powerful

    From these two solution my first bet is RSYNC, it's even portable and cross platform so you can swap your win machine with the operating system of your choice

    Answered by ben
    5 years ago
    0 0
  • I would high recommend looking at using rsync because of it's ability to keep the files synchronized, to make this work you will need to install rsync on the windows system using cygwin as outlined at

    Answered by mfillpot
    4 years ago
    0 0
Please register/login to answer this question. Click here to login
Similar Questions Found
Questions from category Internet

Upcoming Linux Foundation Courses

  1. LFD312 Developing Applications For Linux
    16 Feb » 20 Feb - Atlanta - GA
  2. LFD331 Developing Linux Device Drivers
    16 Feb » 20 Feb - San Jose - CA
  3. LFS220 Linux System Administration
    16 Feb » 19 Feb - Virtual

View All Upcoming Courses

Community Answers - Search

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board