Skip to content

Commit

Permalink
1.4.0, sleep time is from start to start, not from end to start
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrix25633 committed Jun 23, 2022
1 parent 071157c commit ca6e214
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ static void Main(string[] args) {
enumOptions.RecurseSubdirectories = true;
// Other variables
Int32 length, filesToCopy, filesCopied, foldersToCopy, foldersCopied,
filesToRemove, filesRemoved, foldersToRemove, foldersRemoved;
filesToRemove, filesRemoved, foldersToRemove, foldersRemoved, sleepTime;
UInt64 sizeToCopy, sizeCopied, sizeToRemove, sizeRemoved;
Int64 timestamp;
// Parsing arguments
Arguments arguments = new Arguments();
try {
Expand Down Expand Up @@ -105,6 +106,8 @@ static void Main(string[] args) {
Logger.Info("Extension list not set, only file size will be used to compare files");
}
while(true) {
// Timestamp
timestamp = new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds() + arguments.time;
// Scan folders
Logger.Info("Starting source folder scan...");
try {
Expand Down Expand Up @@ -319,7 +322,9 @@ static void Main(string[] args) {
// Close log stream
Logger.TerminateLogging();
if(!arguments.repeat) break;
Thread.Sleep(arguments.time * 1000);
sleepTime = (Int32)(timestamp - new DateTimeOffset(DateTime.UtcNow).ToUnixTimeSeconds());
Logger.Info("Waiting " + sleepTime + " seconds from now, process can be terminated with 'Ctrl + C' before the next scan");
if(sleepTime > 0) Thread.Sleep(sleepTime * 1000);
// Reopen log stream
Logger.ReinitializeLogging();
}
Expand Down

0 comments on commit ca6e214

Please sign in to comment.