ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved WSL using Rsync to fix lazy

    IT Discussion
    windows wsl rsync linux users lazy fixing stupid
    1
    3
    677
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      So here's the breakdown - our users complain that too much work gets completed too quickly and that they can't keep on top of it moving all of the completed work off of our production shares. (it's a long drawn out conversation).

      Anyways' with WSL you can setup a Windows Scheduled Task to call a bash script to use Rsync. This has worked well in my testing on my laptop.

      What Rsync doesn't do is actually delete directories, so I end up with a bunch of empty directories from the source. This is a bit annoying.

      I could of course, call a separate script to delete everything under the source, but this raises little flags in my head what if someone else is moving things by the time the Rsync operation is done - files would be deleted.

      That obviously isn't ideal, so my goal is to get to ZERO on the source only once Rsync has completed for what was there when it ran.

      Looking for ideas so I can test on my system here.

      1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403
        last edited by

        Here's the answer if anyone else is looking for it.

         rsync -avrt --ignore-existing --remove-source-files /mnt/c/Users/DBeuerle/Desktop/Path /mnt/c/Users/DBeuerle/Desktop/Archive/ && \
         rsync -av --delete `mktemp -d`/ /mnt/c/Users/DBeuerle/Desktop/Path
        

        Now to test around and see if this will work as expected on production.

        https://img.devrant.com/devrant/rant/r_648327_iGEVk.jpg

        1 Reply Last reply Reply Quote 2
        • DustinB3403D
          DustinB3403
          last edited by

          Obviously the paths would change based on where they actually live and since I want this to live outside of an individual user, pointing to the user paths would make no sense in a production case.

          Also on WSL, if you go into /mnt you can get a list of all of the disks that are mounted on your Workstation/Server.
          In the case of my workstation I only have the 1 disk, so only c is listed. Severs would likely have other drives.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post