Article View: comp.os.msdos.misc
Article #3938Re: copy 0-byte file from Batch file?
From: John Savage
Date: Fri, 03 Nov 1995 00:00
Date: Fri, 03 Nov 1995 00:00
30 lines
2284 bytes
2284 bytes
kisrael@diamond.tufts.edu (Kirk Israel) writes: >What's the easiest (hopefully 1 line) way to copy a zero-byte file >from the a Batch file (i.e. without prompting the user for info, >ala XCOPY?) > >(Here's why: I'm making a program that generates .BAT files to copy >certain batches of files- but COPY won't copy zero length files, >XCOPY always asks "is this a file or directory", and piping the >letter F into it is *really* inelegant...To make a zero-byte >file I could 'type NUL > filename' but then the date isn't >preserved... ) The UN*X copy utility copies zero byte files, and of course preserves the file's date of creation, so investigate some of the UN*X packages. ftp ftp.cdrom.com /pub/garbo/garbo_pc/unix/ dskutl11.zip Unix-like MS-DOS chmod, cp, du, find, ls, mv, page, rm The XCOPY command asks whether the destination is a Directory or File only where there is the possibility of it being either. Whenever the destination is an *existing* directory, confirmation is not sought. So, if you wish to stay with XCOPY, then you need to arrange things such that the batch script is XCOPYing files from one directory into another, and then the prompt will not trouble you, e.g., XCOPY \MAIL\FLAG.* . where the . is DOS shorthand for the current directory. BTW, if file1 is of 0 bytes, and file2 exists, then the command COPY file1 file2 is identical with DEL file2 (in DOS 5, anyway). -- John Savage koala@sydney.dialix.com.au
Technical Details
Message-ID:
<47crfp$dm6$1@sydney.DIALix.oz.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<46rbqs$klo@d2.tufts.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d683,61db650a63c6e717,start X-Google-Attributes: gid10d683,public X-Google-Thread: f53ba,61db650a63c6e717,start X-Google-Attributes: gidf53ba,public X-Google-Thread: 111d31,61db650a63c6e717,start X-Google-Attributes: gid111d31,public X-Google-Thread: f71eb,61db650a63c6e717,start X-Google-Attributes: gidf71eb,public From: John Savage <koala@sydney.dialix.com.au> Subject: Re: copy 0-byte file from Batch file? Date: 1995/11/03 Message-ID: <47crfp$dm6$1@sydney.DIALix.oz.au> X-Deja-AN: 118543873 sender: koala@sydney.DIALix.oz.au references: <46rbqs$klo@d2.tufts.edu> organization: Gumleaf Smoke Signals Telegraph Co. newsgroups: comp.os.msdos.misc,comp.archives.msdos.d,comp.sys.ibm.pc.misc,aus.computers.ibm-pc