static void
do_mv (void)
{
	char          *from, *to;
	char          *msg;
	MateVFSResult result;

	from = get_fname ();
	to = get_fname ();
	if (!from || !to) {
		fprintf (vfserr, "mv <from> <to>\n");
		return;
	}

	result = mate_vfs_move (from, to, FALSE);

	msg = g_strdup_printf ("%s to %s", from, to);
	show_if_error (result, "move ", msg);
	g_free (msg);
}
Beispiel #2
0
int
main (int argc, char **argv)
{
	MateVFSResult    result;
	char  	         *from, *to;

	if (argc != 3) {
		fprintf (stderr, "Usage: %s <from> <to>\n", argv[0]);
		return 1;
	}

	if (! mate_vfs_init ()) {
		fprintf (stderr, "Cannot initialize mate-vfs.\n");
		return 1;
	}

	command_line_authentication_init ();

	from = mate_vfs_make_uri_from_shell_arg (argv[1]);
	
	if (from == NULL) {
		fprintf (stderr, "Could not guess URI from %s\n", argv[1]);
		return 1;
	}

	to = mate_vfs_make_uri_from_shell_arg (argv[2]);

	if (to == NULL) {
		g_free (from);
		fprintf (stderr, "Could not guess URI from %s\n", argv[2]);
		return 1;
	}

	result = mate_vfs_move (from, to, TRUE);
	show_result (result, "move", from, to);

	g_free (from);
	g_free (to);

	return 0;
}