• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

DOS command help

dbarton

Senior member

i'm trying:

xcopy "T:\in box\*.nfo" d:\nfo /s /d

I want to copy all *.nfo files from all directories under "T:\in box" to a SINGLE directory called D:\nfo

this creates sub dirs under d:\nfo with my files in it.

what can I do to do this better?

 
xcopy isn't up to this. Try:

for /r "t:\in box" %a in (*.nfo) do copy %a d:\nfo

d:\nfo needs to exist beforehand.

"for /?" reveals a wide range of capabilities.
 
Originally posted by: seemingly random
xcopy isn't up to this. Try:

for /r "t:\in box" %a in (*.nfo) do copy %a d:\nfo

d:\nfo needs to exist beforehand.

"for /?" reveals a wide range of capabilities.



The 'for' command seems like it gets close, but I just cant seem to find the right syntax to do this. In your example above, the batch expects the driectories to be called *.nfo, rather than the files contained within them, so it chokes.

I can't seem to find the right command to setp to each directory and copy the *.nfo files.

Anyone?
 
Don't know what to tell you. I tried this before I posted and again just now.

Check that the following returns expected results:

dir /s "t:\in box"

Also if this is a line in a .bat file, then all % need to be doubled - as in %%a. This is a peculiarity of batch processing.
 
this seems to work...

for /r "T:\in box\" %%i in (*.nfo) do copy "%%i" d:\nfo



confused, but it seems to work..

thanks for your help!
 
Yes, makes sense now. The variable in the copy command expands with spaces in your example creating invalid syntax without the quotes. Good job figuring it out.
 
Back
Top