Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive sync skips files already present on target folder #195

Open
wants to merge 5 commits into
base: 2.37
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Archive sync skips files already present on target floder
bitblaster committed Oct 24, 2020
commit c5cb8e057dd33768ad00fd1199e69154081dfcf4
Original file line number Diff line number Diff line change
@@ -544,14 +544,17 @@ static private int archiveFileInternalToSmb(SyncThreadWorkArea stwa, SyncTaskIte
if (!sti.isArchiveUseRename()) {//Renameしない
JcifsFile jf=new JcifsFile(converted_to_path+"/"+item.file_name, stwa.targetAuth);
if (jf.exists()) {
String new_name=createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path+"/"+to_file_name, to_file_ext) ;
if (new_name.equals("")) {
stwa.util.addLogMsg("E","Archive sequence number overflow error.");
sync_result=SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
jf=new JcifsFile(new_name, stwa.targetAuth);
sync_result= moveFileInternalToSmb(stwa, sti, item.full_path, (File)item.file, jf, jf.getPath());
if (SyncThread.isFileChangedForLocalToRemote(stwa, sti, from_path, (File)item.file, jf, stwa.ALL_COPY) &&
SyncThread.checkMasterFileNewerThanTargetFile(stwa, sti, ((File)item.file).getAbsolutePath(), ((File)item.file).lastModified(), jf.getLastModified())) {
String new_name = createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path + "/" + to_file_name, to_file_ext);
if (new_name.equals("")) {
stwa.util.addLogMsg("E", "Archive sequence number overflow error.");
sync_result = SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
jf = new JcifsFile(new_name, stwa.targetAuth);
sync_result = moveFileInternalToSmb(stwa, sti, item.full_path, (File) item.file, jf, jf.getPath());
}
}
} else {
sync_result= moveFileInternalToSmb(stwa, sti, item.full_path, (File)item.file, jf, jf.getPath());
@@ -562,14 +565,17 @@ static private int archiveFileInternalToSmb(SyncThreadWorkArea stwa, SyncTaskIte

JcifsFile jf=new JcifsFile(converted_to_path+"/"+temp_dir+to_file_name+to_file_seqno+to_file_ext, stwa.targetAuth);
if (jf.exists()) {
String new_name=createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path+"/"+temp_dir+to_file_name+to_file_seqno,to_file_ext) ;
if (new_name.equals("")) {
stwa.util.addLogMsg("E","Archive sequence number overflow error.");
sync_result=SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
jf=new JcifsFile(new_name, stwa.targetAuth);
sync_result= moveFileInternalToSmb(stwa, sti, item.full_path, (File)item.file, jf, jf.getPath());
if (SyncThread.isFileChangedForLocalToRemote(stwa, sti, from_path, (File)item.file, jf, stwa.ALL_COPY) &&
SyncThread.checkMasterFileNewerThanTargetFile(stwa, sti, ((File)item.file).getAbsolutePath(), ((File)item.file).lastModified(), jf.getLastModified())) {
String new_name = createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path + "/" + temp_dir + to_file_name + to_file_seqno, to_file_ext);
if (new_name.equals("")) {
stwa.util.addLogMsg("E", "Archive sequence number overflow error.");
sync_result = SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
jf = new JcifsFile(new_name, stwa.targetAuth);
sync_result = moveFileInternalToSmb(stwa, sti, item.full_path, (File) item.file, jf, jf.getPath());
}
}
} else {
sync_result= moveFileInternalToSmb(stwa, sti, item.full_path, (File)item.file, jf, jf.getPath());
@@ -1976,14 +1982,17 @@ static private int archiveFileSmbToSmb(SyncThreadWorkArea stwa, SyncTaskItem sti
if (!sti.isArchiveUseRename()) {
JcifsFile tf=new JcifsFile(converted_to_path+"/"+item.file_name, stwa.targetAuth);
if (tf.exists()) {
String new_name=createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path+"/"+to_file_name, to_file_ext) ;
if (new_name.equals("")) {
stwa.util.addLogMsg("E","Archive sequence number overflow error.");
sync_result=SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
tf=new JcifsFile(new_name, stwa.targetAuth);
sync_result= moveFileSmbToSmb(stwa, sti, item.full_path, (JcifsFile)item.file, tf, tf.getPath(), new_name);
if (SyncThread.isFileChangedForLocalToRemote(stwa, sti, from_path, (File)item.file, tf, stwa.ALL_COPY) &&
SyncThread.checkMasterFileNewerThanTargetFile(stwa, sti, ((File)item.file).getAbsolutePath(), ((File)item.file).lastModified(), tf.getLastModified())) {
String new_name = createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path + "/" + to_file_name, to_file_ext);
if (new_name.equals("")) {
stwa.util.addLogMsg("E", "Archive sequence number overflow error.");
sync_result = SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
tf = new JcifsFile(new_name, stwa.targetAuth);
sync_result = moveFileSmbToSmb(stwa, sti, item.full_path, (JcifsFile) item.file, tf, tf.getPath(), new_name);
}
}
} else {
sync_result= moveFileSmbToSmb(stwa, sti, item.full_path, (JcifsFile)item.file, tf, tf.getPath(), to_file_name);
@@ -1994,14 +2003,17 @@ static private int archiveFileSmbToSmb(SyncThreadWorkArea stwa, SyncTaskItem sti

JcifsFile tf=new JcifsFile(converted_to_path+"/"+temp_dir+to_file_name+to_file_seqno+to_file_ext, stwa.targetAuth);
if (tf.exists()) {
String new_name=createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path+"/"+temp_dir+to_file_name+to_file_seqno,to_file_ext) ;
if (new_name.equals("")) {
stwa.util.addLogMsg("E","Archive sequence number overflow error.");
sync_result=SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
tf=new JcifsFile(new_name, stwa.targetAuth);
sync_result= moveFileSmbToSmb(stwa, sti, item.full_path, (JcifsFile)item.file, tf, tf.getPath(), new_name);
if (SyncThread.isFileChangedForLocalToRemote(stwa, sti, from_path, (File)item.file, tf, stwa.ALL_COPY) &&
SyncThread.checkMasterFileNewerThanTargetFile(stwa, sti, ((File)item.file).getAbsolutePath(), ((File)item.file).lastModified(), tf.getLastModified())) {
String new_name = createArchiveSmbNewFilePath(stwa, sti, converted_to_path, converted_to_path + "/" + temp_dir + to_file_name + to_file_seqno, to_file_ext);
if (new_name.equals("")) {
stwa.util.addLogMsg("E", "Archive sequence number overflow error.");
sync_result = SyncTaskItem.SYNC_STATUS_ERROR;
break;
} else {
tf = new JcifsFile(new_name, stwa.targetAuth);
sync_result = moveFileSmbToSmb(stwa, sti, item.full_path, (JcifsFile) item.file, tf, tf.getPath(), new_name);
}
}
} else {
sync_result= moveFileSmbToSmb(stwa, sti, item.full_path, (JcifsFile)item.file, tf, tf.getPath(),