Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,832 of 68,980    |
|    John Stockton to LangerTom    |
|    Re: Problem with file copying in Batch    |
|    11 Nov 21 10:03:07    |
      From: dr.j.r.stockton@gmail.com              On Sunday, 7 November 2021 at 19:56:56 UTC, LangerTom wrote:       > Am 04.11.2021 um 23:30 schrieb John Stockton:                      > > That works, except that every time Xcopy is called, I get, on-screen,        > >        > > "Does C:\MYSLIDES\ZZZ\33-xxxiii\11.jpg specify a file name        > > or directory name on the target        > > (F = file, D = directory)?"        > >        > > An answer of F works, but I don't want to be asked; there may be over 100       calls. I've tried XCOPY /?, but cannot recognise a suitable option.        > >        > > What should I do?        > >       > If I remember correctly you should add a trailing back slash to the        > target. This tells xcopy to copy files to a target directory.        >        > xcopy /f %%J ZZZ\%%J\        >        > (not tested)               I think you have the right idea, but adjustment is needed.        A typical command line is        Xcopy /D /F /Y 37-xxxvii\20.jpg ZZZ\37-xxxvii\20.jpg       and I think I want to remove the trailing 20.jpg - but another typical line       is        Xcopy /D /F /Y scans\oven\1516.png ZZZ\scans\oven\1516.png       with more sub-folders - I need to remove the characters after the LAST \       character.       The extension part will be three characters, but there could be any number of       characters in the file name before the extension.              I don't know how to do that in reasonably brief pure batch.              Might %~pI be used? - seems not;         Xcopy /D /F /Y %%J ZZZ\%%~pJ copies to C:\MYSLIDES\ZZZ\MYS       IDES\37-XXXVII\20.JPG !!              I had thought, as I said, to automate typing all those F responses by piping       in a file full of Fs - no good.              But it is possible to depress the F key when first asked for it, keep it down       while all the XCOPY output scrolls rapidly upwards, and release it when a       briskly-flowing line of Fs appears. Since this batch program will almost       always be started by hand,        and finishes directly after the copying, that is good enough. The repeat rate       of the F key is much faster than that of my finger-pressing. If I release the       F key too soon, F.BAT will maybe run (it starts File Explorer), but commands       starting with        multiple-F are not implemented here.                            I have fixed the MiniTrue -o pipe/redirect error difficulty : I copy the input       file, then in multiple MiniTrue passes on the copy, I : (0) prepend OMIT to       all lines, (1 to N) alter OMIT to STET on lines wanted for various reasons,       (N+1) remove the OMIT        lines and the STET words. STET is logically redundant, but it helps when       visually checking.              The line copy A+B+C A is not a good way to extend file A.              So : all is well enough with the image file copying, maybe.              It only remains to STET the |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca