Allow file overwrite
This commit is contained in:
parent
ed285a08e8
commit
72994392b3
@ -50,6 +50,10 @@ v0.71.2 16-Jan-2005
|
|||||||
Added debug logging for exporting netmails from the messagebase
|
Added debug logging for exporting netmails from the messagebase
|
||||||
so that we later can decide to mark these messages auto deleted.
|
so that we later can decide to mark these messages auto deleted.
|
||||||
|
|
||||||
|
mbfile:
|
||||||
|
With adopt, import and move allow to overwrite a file with the
|
||||||
|
same name if the -f option is used on the commandline.
|
||||||
|
|
||||||
mbnntp:
|
mbnntp:
|
||||||
Does now send the right mime headers recognised by news clients.
|
Does now send the right mime headers recognised by news clients.
|
||||||
Fixed compile problem with some compilers.
|
Fixed compile problem with some compilers.
|
||||||
|
8
TODO
8
TODO
@ -130,19 +130,11 @@ mbcico:
|
|||||||
N: Implement PLZ turn off m_get command.
|
N: Implement PLZ turn off m_get command.
|
||||||
|
|
||||||
mbfile:
|
mbfile:
|
||||||
L: Update <filespec> <area> <-touch>
|
|
||||||
|
|
||||||
L: Possibility to skip file areas from checking and reindexing.
|
L: Possibility to skip file areas from checking and reindexing.
|
||||||
|
|
||||||
U: mbfile import refuses to import (overwrite) a file that is already
|
|
||||||
in the file area. See also adopt.
|
|
||||||
|
|
||||||
N: It is not possible to import areas that run of cd-roms. Do we still
|
N: It is not possible to import areas that run of cd-roms. Do we still
|
||||||
need cd-rom support with current hd prices?
|
need cd-rom support with current hd prices?
|
||||||
|
|
||||||
N: Add commandline switch for adopt that allows replacing files that
|
|
||||||
already exist.
|
|
||||||
|
|
||||||
mbnntp:
|
mbnntp:
|
||||||
U: fetched mail doesn't get the status Rcvd if it was for the user.
|
U: fetched mail doesn't get the status Rcvd if it was for the user.
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ int do_move = FALSE; /* Move a file */
|
|||||||
int do_del = FALSE; /* Delete/undelete a file */
|
int do_del = FALSE; /* Delete/undelete a file */
|
||||||
int do_sort = FALSE; /* Sort a filebase */
|
int do_sort = FALSE; /* Sort a filebase */
|
||||||
int do_rearc = FALSE; /* ReArc a file */
|
int do_rearc = FALSE; /* ReArc a file */
|
||||||
|
int do_force = FALSE; /* Force file overwrite */
|
||||||
extern int e_pid; /* Pid of external process */
|
extern int e_pid; /* Pid of external process */
|
||||||
extern int show_log; /* Show logging */
|
extern int show_log; /* Show logging */
|
||||||
time_t t_start; /* Start time */
|
time_t t_start; /* Start time */
|
||||||
@ -224,6 +225,8 @@ int main(int argc, char **argv)
|
|||||||
do_annon = TRUE;
|
do_annon = TRUE;
|
||||||
} else if (!strncasecmp(argv[i], "-v", 2)) {
|
} else if (!strncasecmp(argv[i], "-v", 2)) {
|
||||||
do_novir = TRUE;
|
do_novir = TRUE;
|
||||||
|
} else if (!strncasecmp(argv[i], "-f", 2)) {
|
||||||
|
do_force = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
extern int do_quiet; /* Suppress screen output */
|
extern int do_quiet; /* Suppress screen output */
|
||||||
|
extern int do_force; /* Force file overwrite */
|
||||||
extern int e_pid; /* Pid of external process */
|
extern int e_pid; /* Pid of external process */
|
||||||
extern time_t t_start; /* Start time */
|
extern time_t t_start; /* Start time */
|
||||||
extern time_t t_end; /* End time */
|
extern time_t t_end; /* End time */
|
||||||
@ -129,6 +130,7 @@ void Help(void)
|
|||||||
printf("\n Options are:\n\n");
|
printf("\n Options are:\n\n");
|
||||||
mbse_colour(CYAN, BLACK);
|
mbse_colour(CYAN, BLACK);
|
||||||
printf(" -a -announce Suppress announce added files\n");
|
printf(" -a -announce Suppress announce added files\n");
|
||||||
|
printf(" -f -force Force file overwrite\n");
|
||||||
printf(" -q -quiet Quiet mode\n");
|
printf(" -q -quiet Quiet mode\n");
|
||||||
printf(" -v -virus Suppress virus scanning, use with care\n");
|
printf(" -v -virus Suppress virus scanning, use with care\n");
|
||||||
die(MBERR_COMMANDLINE);
|
die(MBERR_COMMANDLINE);
|
||||||
@ -319,14 +321,18 @@ int AddFile(struct FILE_record f_db, int Area, char *DestPath, char *FromPath, c
|
|||||||
mkdirs(DestPath, 0775);
|
mkdirs(DestPath, 0775);
|
||||||
|
|
||||||
if ((file_exist(DestPath, F_OK) == 0) || (file_exist(LinkPath, F_OK) == 0)) {
|
if ((file_exist(DestPath, F_OK) == 0) || (file_exist(LinkPath, F_OK) == 0)) {
|
||||||
|
if (do_force) {
|
||||||
|
Syslog('+', "File %s (%s) already exists in area %d, forced overwrite", f_db.Name, f_db.LName, Area);
|
||||||
|
} else {
|
||||||
WriteError("File %s (%s) already exists in area %d", f_db.Name, f_db.LName, Area);
|
WriteError("File %s (%s) already exists in area %d", f_db.Name, f_db.LName, Area);
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("\nFile %s (%s) already exists in area %d\n", f_db.Name, f_db.LName, Area);
|
printf("\nFile %s (%s) already exists in area %d\n", f_db.Name, f_db.LName, Area);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((rc = file_cp(FromPath, DestPath))) {
|
if ((rc = file_cp(FromPath, DestPath))) {
|
||||||
WriteError("Can't copy file in place");
|
WriteError("Can't copy file to %s, %s", DestPath, strerror(rc));
|
||||||
if (!do_quiet)
|
if (!do_quiet)
|
||||||
printf("\nCan't copy file to %s, %s\n", DestPath, strerror(rc));
|
printf("\nCan't copy file to %s, %s\n", DestPath, strerror(rc));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Reference in New Issue
Block a user