Re: Copying silently.



Ali wrote:

On Tue, 13 Mar 2007 20:51:31 GMT, Frederick Williams commented

copy /y x y >> nul:

will copy x to y and not tell me that it's done so, nor will it ask me
to confirm that y should be copied over if it already exists. Good,
that (so far as it goes) is what I want.

Unfortunately if x doesn't exist I won't see the message "The system
cannot find the file specified.". I could test errorlevel if my copy
command was in a batch file, but I'd like it to be one command on the
command line. So my question is this:

Is there a switch to copy that means "Keep quite unless the source
doesn't exist."?

There is no switch that means "keep Quiet" at all, which is why you
redirect the output to nul:

It ought to be possible to redirect standard output and error output
independently of one another, you can with Unix.

If the output is important, leave it visible.

Xcopy may be of more use, particularly the \Q option

Trouble is

xcopy file-that-exists file-that-doesn't-exist

wants to know if file-that-doesn't-exist is a directory or not.

You do know that /? after any standard command lists its options?

Yes.

Thanks.

--
Remove "antispam" and ".invalid" for e-mail address.
We have lingered in the chambers of the sea
By sea-girls wreathed with seaweed red and brown
Till human voices wake us, and we drown.
.



Relevant Pages

  • Re: USB drive problem
    ... Once per month I update the files using a batch file ... using this context for the copy command: ... that folder. ... The first problem I see is that there is no U or S switch for COPY. ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: Backup runs manually OK, needs input when scheduled?
    ... The relevant command lines in the batch file are: ... conjunction with certain other command line switches mind you. ... Strange thing is that I cannot think how this [or any other switch] would ...
    (microsoft.public.backoffice.smallbiz2000)
  • Re: total size of files
    ... echo Total=%Total% ... I'm aware of the /-c switch for the "dir" command - it would come in handy if the OP decided to total up the numbers from several servers. ... I note with concern that we're deep into a batch file discussion even though we're in a VB Scripting group. ...
    (microsoft.public.scripting.vbscript)
  • Re: application shut down does not force logout
    ... It's not the /wait switch which makes it work, it's the logoff ... command afterwards, which forces the logoff. ... You need the /wait switch to tell Windows that it must wait until ... >>> here is what is in the batch file ...
    (microsoft.public.windows.terminal_services)
  • Re: C2960 config - What do the commands do
    ... To enable visible sequence numbering of system logging messages, use the service sequence-numbers command in global configuration mode. ... Configure the system to automatically switch to summer time. ... This sybnet has the same network address what main network (the subnetted one) but longer subnet mask ... For chassis with 64 MAC addresses, STP uses the extended system ID plus a MAC address to make the bridge ID unique for each VLAN. ...
    (comp.dcom.sys.cisco)