5 const char mv_usage[] = "mv source-file destination-file\n"
6 "\t\tmv source-file [source-file ...] destination-directory\n"
8 "\tMove the source files to the destination.\n"
12 mv_fn(const struct FileInfo * i)
14 struct stat destination_stat;
18 if ( stat(i->destination, &destination_stat) == 0 ) {
19 if ( i->stat.st_ino == destination_stat.st_ino
20 && i->stat.st_dev == destination_stat.st_dev )
21 return 0; /* Move file to itself. */
23 if ( (destination_stat.st_mode & S_IFMT) == S_IFDIR ) {
25 n.destination = join_paths(d, i->destination, basename(i->source));
28 if ( rename(i->source, i->destination) == 0 )
30 else if ( errno == EXDEV && is_a_directory(i->source) ) {
32 ,"%s: Can't move directory across filesystems.\n"