Sync Surprise

Jul 1, 2008
81
0
71
Montreal
#1
Windows XP SP3 all up to date, TCC 11.00.51

The SYNC help says about the /N option:
"Do everything except actually perform the copy. This option is useful for testing the result of a complex SYNC command. /N displays how many files would be copied. /N does not prevent creation of destination subdirectories when it is used with /S."

Neither, apparently, does it prevent the deletion of destination subdirectories when used with /S and /W.

I tested this command with the /N option
SYNC /N/S/E/W .\ "C:\DOCUMENTS AND SETTINGS\UBRAP0\FAVORIS\"

Its report was as expected:
69 files would be copied
SYNC: "C:\Documents and Settings\ubrap0\Favoris\" => D:\y
0 files would be copied

So I ran the command without the /N option...
SYNC /S/E/W .\ "C:\DOCUMENTS AND SETTINGS\UBRAP0\FAVORIS\"

...but got an error:
Usage : SYNC [/A:[[-][+]rhsdaecjot] /CDEGH /I"text" /JKLM /N[dejnst] /O:[-]adegnrstu /OPQR /Sn /TVWX] dir1 dir2

Except for the /N option, the second command syntax was identical to the first, so why the error message? Because "C:\Documents and Settings\ubrap0\Favoris" no longer existed, the first "test" command had removed it. Surprise!

I think the behaviour should be corrected or be noted in the help.
--
Peter
 
May 26, 2008
488
4
#2
Wow, that is pretty bad IMO. /N should truly do nothing. I don't even like that caveat as stated in the help file.

Why create subfolders in a test sitatuaion? If it doesn't exist and sync is being run in test mode, it should assume that all files destined for a missing target folder will be copied.

Seems very sloppy.
 

rconn

Administrator
Staff member
May 14, 2008
10,325
94
#3
> Why create subfolders in a test sitatuaion? If it doesn't exist and
> sync is being run in test mode, it should assume that all files
> destined for a missing target folder will be copied.
That assumption won't work, as in some situations the folders cannot be
created, so a SYNC /N would work and it would fail when the /N was removed.

Using that approach, I could just alias "SYNC /N" to "REM"! If SYNC doesn't
create the folders and it doesn't copy the files, exactly what *is* it
doing??

Rex Conn
JP Software
 
#4
On Mon, 02 Aug 2010 19:18:30 -0400, rconn <> was
claimed to have wrote:


>---Quote---
>> Why create subfolders in a test sitatuaion? If it doesn't exist and
>> sync is being run in test mode, it should assume that all files
>> destined for a missing target folder will be copied.
>---End Quote---
>That assumption won't work, as in some situations the folders cannot be
>created, so a SYNC /N would work and it would fail when the /N was removed.
>
>Using that approach, I could just alias "SYNC /N" to "REM"! If SYNC doesn't
>create the folders and it doesn't copy the files, exactly what *is* it
>doing??
I thought the point of the "do (N)othing" type switches it to let the
user inspect the output to determine if the command appears to more or
less do what was intended without actually doing anything?

At least that's how I use it on del with complicated wildcards or
exclusions...
 
May 26, 2008
488
4
#5
That assumption won't work, as in some situations the folders cannot be
created, so a SYNC /N would work and it would fail when the /N was removed.
Ok, I can see your point but I'm not sure I personally agree with it.

Using that approach, I could just alias "SYNC /N" to "REM"! If SYNC doesn't create the folders and it doesn't copy the files, exactly what *is* it doing??
Well REM won't show any sort of simulation as to what SYNC might do. The /N, even if it makes some assumptions, should just show a simulation.

There is no way you can verify that if the simulation works then removing the /N would result in a completely successful SYNC. What if the destination runs out of free space or your quota is exceeded? What if a file is in use in the destination? What if the permissions in the destination do not allow file creation?

Perhaps it is just my opinion, but I think a "do nothing" switch should really do nothing and only simulate what would happen. It should perform all the read-only checks it can, of course, like verifying that the destination exists.
 
Jul 1, 2008
81
0
71
Montreal
#6
If SYNC doesn't create the folders and it doesn't copy the files, exactly what *is* it doing??
Indeed, it would be doing nothing. It needs to flag the directories it creates, and delete only those.

I neglected to state in my first post that FAVORIS contained 5 populated subdirectories -- SYNC /N deleted directories and about 60 files.
--
Peter
 
#7
Steve Fabian wrote:
| Rod Savard wrote:
|| Perhaps it is just my opinion, but I think a "do nothing" switch
|| should really do nothing and only simulate what would happen. It
|| should perform all the read-only checks it can, of course, like
|| verifying that the destination exists.
|
| I concur. The target should be left as it was.
Sorry, something stppped sending above from a WiFi location.
--
Steve