Page 2 of 2

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 03:58
by drgt
Compo wrote:If you are only performing a copy, and one which will happen relatively quickly, why would the order matter? If I was copying the content of a script on here, the end product would look exactly the same if copied it from bottom to top or the opposite.


Some devices like the ASUS OPlay list files in disk order rather than alphabetical order. That makes it hard to find what you are looking for. Using this method, the disk order and the alpha order will match. Unfortunately, you have to copy all files from scratch when you add files...

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 04:01
by drgt
Sounak@9434 wrote:I am just replying based on the command you said earlier 'dir c:\a\b\c /a-d /on /b'


Thank you! Just a little edit if you run this from another directory...

Code: Select all

for /f "delims=" %%a in ('dir c:\a\b\c /a-d /on /b') do (
   copy "c:\a\b\c\%%a" "c:\d\e\f"
)

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 04:12
by drgt
One says the pipe character must be used if file names contain spaces:

for /f "delims=|".....

True?

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 04:34
by Compo
False, (leave it as it was).

…and as I've said, it doesn't matter which order you copy those files, it will not effect the default directory sort order.

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 04:38
by Sounak@9434
drgt wrote:One says the pipe character must be used if file names contain spaces:

for /f "delims=|".....

True?

As filename can't contain "|"(pipe) character by default it does not matter if you use | as a delim or just leave "delims="

Sounak

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 09:32
by drgt
Compo wrote:…and as I've said, it doesn't matter which order you copy those files, it will not effect the default directory sort order.


Thanks!

Here is an example of disk order listing:
Image

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 09:56
by Compo
@drgt, I fail to see the relevance.

You've shown a couple of images showing directory structures.
That has no bearing whatsoever on the order that files are copied into your specifically named folder.


If you were intercepting the files during their copy, for an intermediate action, I may understand the need to copy them in an order but not for a direct A to B copy process.

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 10:33
by drgt
I will try again.
Image

Image

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 11:14
by Compo
That is just an output of the DIR command, it has no bearing whatsoever on the directory order of files when copied. There should be no relationship between the viewed directory order and the order at which files were copied to the device..

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 11:19
by drgt
Then why the device displays them in alpha order when copied in alpha order and not so when they are copied in the conventional way?

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 12:08
by Aacini
Compo,

Perhaps you not remember, but in the old MS-DOS command.com days the DIR command did not sorted the files in any order, so they always appear in the same order the files were copied to the disk. If you have any device that does not sort the files by name (like many cheap MP3 players, for example), then the files will be processed in the order they were copied to the disk, so in these cases such an order is important.

Antonio

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 12:25
by Squashman
We have Networked attached storage that does this as well. Irritates the hell out of me on that server.

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 12:57
by pieh-ejdsch
The file system at MFT or FAT is like a table of contents (TOC) in books or an archive file.
If the file stored on the hard disk is recorded on these repositories.
Your files are listed in this list.
When you duplicate your files, this list is read and treated one by one like the table of contents.

Phil

Re: FOR command / batch including DIR

Posted: 06 Jan 2017 13:19
by drgt
Thank you all for your contributions!
Happy New Year!