Skip to content
Snippets Groups Projects
Commit fdce7faa authored by Wei Liu's avatar Wei Liu
Browse files

change the --overwrite behaviour to overwrite only the files with different sizes

parent 0438840a
Branches
Tags
No related merge requests found
......@@ -61,9 +61,9 @@ public class MFDownload extends MFSyncApp {
System.out.println(" --no-cluster-io Disable cluster I/O if applicable.");
System.out.println(" -o, --out <dst-dir> The output/destination directory.");
System.out.println(" --overwrite Overwrite if the dst file exists.");
System.out.println(" --overwrite Overwrite if the destination file exists but has a different size.");
System.out.println(" --unarchive Extract Arcitecta .aar files.");
System.out.println(" --csum-check Files are equated if the name and size are the same. In addition, with this argument, you can optionally compute the CRC32 checksumk to decide if two files are the same.");
System.out.println(" --csum-check Generate the CRC32 checksum during the file download and compare it with the remote checksum after the download is complete. If both the --csum-check and --overwrite options are enabled, local files will be overwritten even if their sizes match the remote files.");
System.out.println(" --no-symlinks Do not restore symbolic links. If not specified, it will try to create (restore) symbolic links. Note: creating symbolic links works only the platforms that support symbolic links, such as Linux or MacOS.");
System.out.println(" --nb-queriers <n> Number of query threads. Defaults to " + unimelb.mf.client.sync.settings.Settings.DEFAULT_NUM_OF_QUERIERS + ". Maximum is " + Settings.MAX_NUM_OF_QUERIERS);
System.out.println(" --nb-workers <n> Number of concurrent worker threads to download data. Defaults to " + unimelb.mf.client.sync.settings.Settings.DEFAULT_NUM_OF_WORKERS + ". Maximum is " + Settings.MAX_NUM_OF_WORKERS);
......
......@@ -28,7 +28,6 @@ import arc.xml.XmlDoc.Element;
import arc.xml.XmlStringWriter;
import unimelb.io.ProgressMonitorInputStream;
import unimelb.mf.client.archive.MFArchive;
import unimelb.mf.client.file.PosixAttributes;
import unimelb.mf.client.session.MFOutputConsumer;
import unimelb.mf.client.session.MFSession;
import unimelb.mf.client.sync.settings.PathTransformer;
......@@ -358,13 +357,11 @@ public class AssetDownloadTask extends AbstractMFTask {
return;
}
} else {
PosixAttributes fileAttrs = PosixAttributes.read(file);
long fileSize = Files.size(file);
long assetPosixMTime = ae.longValue("content/time/@millisec", -1);
if (fileSize == assetContentSize && assetPosixMTime > 0 && assetPosixMTime == fileAttrs.mtime()) {
if (fileSize == assetContentSize && !csumCheck) {
dl.transferSkipped(assetPath, file);
logger.info("Skipped asset " + assetId + ": '" + assetPath
+ "' Destination file already exists. Both file sizes and mtimes match.");
+ "' Destination file already exists and file sizes are match.");
return;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment