[Novalug] scp : skip xy.z??
Michael Henry
lug-user@drmikehenry.com
Sat May 30 10:58:34 EDT 2009
Beartooth wrote:
> I've got Fedora 11 Preview re-installed on a T30 Thinkpad. It installed
> all right the first time, but when I scp'd /home/btth from this machine
> (where things work) onto it, .wine swelled up to 18 GB (half the laptop's
> capacity) *and* got so messed up, in some way, that it crashed the
> machine when I tried to launch it. (.wine on this machine is only 6 GB)
>
> So this time I want to do something like scp /home/btth <skip .wine,
> ISOs, etc. -- the big files I don't need>
If you have konqueror installed (part of KDE), you could use
the fish:// protocol for the copy. Then you could graphically
select the files you want to transfer using konqueror's copy
and paste. To try this, put a URL like the following into
konqueror's location bar:
fish://remote_machine/
This will use SSH to connect to the other machine, and you can
then copy files between konqueror windows.
You might also try rsync instead of scp, where you can use
the --exclude switch. For example, I have a temporary directory
with the following content:
mike@t61:~/tmp/rsync$ find
.
./.junk
./.junk/ignore-me
./.junk/big-file
./one
./one/another.iso
./test.iso
./two
./two/good-file.txt
./three
To copy these files over to a server named "wench" in the corresponding
location (~/tmp/rsync/), you might try a command like the following:
mike@t61:~/tmp/rsync$ rsync -ax -vv --dry-run ~/tmp/rsync/
wench:tmp/rsync/ --exclude '*.iso' --exclude .junk
The above is all one line. The switches are as follows:
-a Archive (preserve permissions, recurse into directories)
-x Exclude other mounted filesystems
-v Verbose (repeated for more verbosity)
--dry-run Don't actually do the work
--exclude Skip over files and directories that match the supplied glob
The "--exclude '*.iso'" line will skip over all .iso files, and
"--exclude '.junk'" will skip over the .junk directory. The output
from the above command on my computer gives:
building file list ...
[sender] hiding directory .junk because of pattern .junk
[sender] hiding file test.iso because of pattern *.iso
[sender] hiding file one/another.iso because of pattern *.iso
done
delta-transmission enabled
./
one/
three/
two/
two/good-file.txt
total: matches=0 hash_hits=0 false_alarms=0 data=0
sent 172 bytes received 50 bytes 444.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
Notice that rsync tells you what it will skip, so you can tune the
command line until you are satisfied. When you are happy with the
proposed results, you can remove the --dry-run flag to make it do
the copy for real.
man rsync for more details.
Michael Henry
More information about the Novalug
mailing list