Sunday, July 1, 2007

find is an amazing tool, but it can't use Gnome-vfs

I use the find command line utility nearly every day. It is amazing to manipulate large directory hierarchy with files. Unfortunately, I have missed the possibility to do like this:
find -type f -exec gnomevfs-copy {} . \;
The example above is of course stupid since it will take for ever and fill my hard drive but you get the idea. I need the similar functionality to copy video-files from my PVR, Kiss DP-558, to my Ubuntu server.

This weekend I decided to solve the problem, so I created gvfsfind. The prefix gvfs since it is based on gnome-vfs. The tool has a help that I hope can get you to start using it. Just start it with the flag -h.
This example prints all directories on the ftp-site: --type d --print
To copy all files ending with .vob from the host skipper to the local host: ssh://skipper/srv/movie --type f --name ".*\.vob" --exec "gnomevfs-copy %u ."
Create all directories on the remote host skipper on the localhost:
gvfsfind ssh://skipper/ --type d --exec mkdir %d
Then copy all the files to the local host:
gvfsfind ssh://skipper/ --type f --exec gnomevfs-copy %u %d/%f

For now I license the software in GPL version 2. It will probably change when I have read version three.

Please note that you must access remote hosts anonymously or using cryptographic keys.

No comments: