OS X Tip for copying a large file from a windows server over smb
Monday, October 22, 2007
Here's a tip.
Problem:
You have connected to a windows share at an address like smb://myserver. You tried copying the file from the mounted share to your computer. It's going to take a long time. Either the connection gets dropped, or you accidentally drop it, or you need to go somewhere but you can't because if any of these things happens, you'll have to start all over again.
Solution:
Initiate a copy with the 'curl' command that can be resumed later. Crack open your Terminal, and navigate to the location where you want to save your file. With the smb share mounted already in your Finder, figure out the path to the file. I usually use 'ls' to get the path right.
i.e.
ls /Volumes/myserver/path/to/the/file.mov
should show something like
file.mov
Now that you know the path (make sure to escape spaces in the path by prefixing them with a \. i.e.
ls /Volumes/myserver/path/to/the\ big/file.mov
if you can get the 'ls' command to work and see the file, then your path must be right.
copy and paste that path with the excaped spaces starting with /Volumes...
and prefix it with file://, so you'll end upwith an initial three forward slashes like
file:///Volumes/myserver/path/to/the\ big/file.mov
That's the way 'curl' likes the paths for a file copy. So now that you're in the place on your computer where you want the file to end up, type (and this O is a letter not zero):
curl -O file:///Volumes/myserver/path/to/the\ big/file.mov
You'll even see progress and time estimate.
If something bad happens, you'll be left with a partial file. (If you did this in the finder, you would be left with nothing)
To resume, make sure you're in the same directory as the first time, then type:
curl -O -C - file:///Volumes/myserver/path/to/the\ big/file.mov
That's it. This tip is best for one big file. For multiple files, look into the mighty 'rsync' command.

0 Comments:
Post a Comment
<< Home