Command-line sort and copy text files to one single file renders an error

Posted by user169997 on Super User See other posts from Super User or by user169997
Published on 2012-11-04T05:04:09Z Indexed on 2012/11/04 5:07 UTC
Read the original article Hit count: 438

Filed under:
|
|
|

I stumbled on question 217394 which explains how to copy files sorted alphabetically into one single file. Trying to implement the command myself rendered the following error message: The system cannot find the file specified.
The command I am trying to run is here:

for /f %i in ('dir /a-d /o-n /b O:\OrdersExport\Order*.txt') do @type %i >> C:\Users\Admin\Documents\OrderImport.txt

The error does not appear if I browsed to the folder in question first:

C:\>O:
C:\>cd OrdersImport

I simply want one line to copy from destination to that single file.

By the way, if it matters, O: is a mapped folder over network

© Super User or respective owner

Related posts about Windows

Related posts about command-line