Move files between two windows file shares on the same server

Using Windows 7 I have a server with shared folders set up. If I open one of them and take a file and move it to a subfolder it's instant - the file is obviously only being moved on the server. The same for two windows having the same shared folder open.

If I on the other hand open another shared folder on the same server and move a file between them it takes very long time - like it's downloading the file from the first share to my computer in a temp folder and then uploading it to the other share.

Is there some way to move files between different shares like this without my computer downloading them in between? I want some speed because it's often quite large files.


When you say, “another shared folder”, do you mean “a folder in a different file share (i.e., a different mapped drive)”?  If so, that’s the issue, and there is no easy, magic fix.  When you move a file from one folder to another on the same volume, all that needs to happen is for the operating system to write a new directory entry in the destination folder and erase the old directory entry in the source folder — the file data doesn’t need to be accessed.  When you copy a file, the OS must read each data block and write it in a new location.  And a move between volumes might as well be a move between physically separate disks — it must be treated as a copy followed by a delete of the source file — because directory entries cannot point to data blocks on a different volume.

P.S. Ironically, a move between physically separate disks might even be faster than a move between partitions (volumes or “shares”) on the same disk, because in the latter case the disk I/O heads need to jump back and forth between the source cylinder(s) and the destination cylinder(s).


Even though I'm late for the feast, still, here is the recipe, and I believe it's a practical method, with some preconditions.

  • The core idea is telling the server to move the objects in a particular location (which of course is in one Samba share) to another location (which of course is in another Samba share).

  • inotifywait is the chef, with the cookers called while, read, and mv. That's the team for our dinner.

  • And the kitchen (or maybe dinning room) looks like this:

Samba shares ├─share.1 │ ├─recv │ ├─to.share.2 │ ├─to.share.3 │ └─[...] ├─share.2 │ ├─recv │ ├─to.share.1 │ ├─to.share.3 │ └─[...] ├─share.3 │ ├─recv │ ├─to.share.1 │ ├─to.share.2 │ └─[...] └─[...]

A user login to, let's say, share.x. If the user wants to move/copy something inside share.x to share.y, here is the operation:

  1. Pick the objects inside share.x, move/copy them to share.x/to.share.y.

  2. The server is monitoring those to.share.* folders with inotifywait, thus it knows it's time to work.

  3. The server moves the objects inside share.x/to.share.y to share.y/recv.

  4. Done!

The preconditions include, a particular folder structure as above, a job/service/script run on the server to do the real mv operation.

I do have my own script code to share with you, but there're a lot of improvements to make:

inotifywait -m "$source_dir" --format '%w%f' -e moved_to,create,modify | while read file; do mv -v "$file" "$dest_dir"; done

Modify those $source_dir and $dest_dir to fit your own need.

I use supervisor to manage a bunch of scripts such as above to make my "Samba teleportation". If you're not familiar with supervisor, please refer to http://supervisord.org/ and other answers about it.


Easiest/quick and dirty way would be to either do it from the server itself, or create a share that has both target shares as subfolders (e.g. \\servername\c$).