How do I set a custom order for folders on Windows 7 and 10?

19

3

I have folders with these names:

  • Introduction
  • Theoretical Background
  • Methods
  • Results
  • Conclusion

and would like to keep this sequence.

Unfortunately, Windows 7 doesn't let me and orders the folders according to their names or alteration date.

How can I fix the sequence of folders in Windows 7 and 10 according to my requirements?

Is it maybe possible to set an additional folder attribute like "1" or "2" and let Windows sort according to this attribute?

Daniel

Posted 2019-09-18T13:28:05.730

Reputation: 207

1You want to observe this sequence in what context? In Explorer? Something else? Directory order is ultimately a property of display, not of the filesystem (though one can leverage various properties at the filesystem layer to manifest various orderings) – Lightness Races with Monica – 2019-09-20T13:21:16.740

I would like to oberserve this sequence in the file explorer. – Daniel – 2019-09-20T23:21:07.543

Answers

0

First of all, thank you so much for your responses to my question!

I presented them to my colleagues and now half of them are using Jeff's and the other half Richie's solution.

Jeff's solution is, as pointed out by @Dubu, stable across different file systems, works with backups and is portable to other operating systems. Moreover, the solution is fast and easy to accomblish for everyone.

Now, let's assume you are using LaTeX for writing your thesis, then you will use similiar lines of code to insert your sections:

\input{./03_Section_A/Section_A.tex}
\input{./04_Section_B/Section_B.tex}

Let's also assume that you make the decision to add a new section, which should come between two existing sections (here between 03 and 04). Which changes are needed to add the new section in the sequence of folders? Using Jeff's solution, you need to rename all existing folders and adjust all paths in your LaTeX file accordingly:

\input{./03_Section_A/Section_A.tex}
\input{./04_NewSection/NewSection.tex}
\input{./05_Section_B/Section_B.tex}

Here, Richie's solution comes in handy. In fact, you do not need numbers in front of folder names anymore. If you make the decision to add a new section, which should come between two existing sections, you just need to update the desktop.ini files. Any adjustments in the LaTeX file, besides inserting the new section, is not needed.

\input{./SectionName_A/Section_A.tex}
\input{./NewSection/NewSection.tex}
\input{./SectionName_B/Section_B.tex}

To sum up, it is a personal decision to use Jeff's or Richie's solution. Both of them are great.

Daniel

Posted 2019-09-18T13:28:05.730

Reputation: 207

49

I generally do this by simply prefixing the folders with either letters or numbers, as though they were sections of a document:

1 - Introduction
2 - Theoretical Background
3 - Methods
4 - Results
5 - Conclusions

If there are more than ten "sections", I will use a two-digit zero-padded prefix, e.g., 01, 02, 03, etc.; I've never been quite so deranged as to insist that I need this for a group of over about 15 folders. (Even if I did, I could probably manage to script the rename.)

Jeff Zeitlin

Posted 2019-09-18T13:28:05.730

Reputation: 2 918

Alphabetic chapter ordinals also work well (A,B,C). – Christopher Hostage – 2019-09-18T15:57:25.020

I think even Windows 7 is smart enough to sort 2 before 10. Zero-prefixing is not necessary in that case. – MSalters – 2019-09-19T13:00:21.657

3Upvoted. Although it tweaks the question a bit, this solution is stable across different file systems, works with backups, and is even portable to other operating systems. – Dubu – 2019-09-19T13:01:13.353

4@MSalters - Yes, Windows is smart enough to do so, but occasionally I've gotten anomalous results where it doesn't sort numerics as numerics, so I zero-pad just to prevent that. – Jeff Zeitlin – 2019-09-19T13:45:11.310

1As for why you may see this vary, numeric sorting of this type is a feature of Explorer - only in Windows XP and later - and is optional, enabled by default. Other applications presenting file lists may choose their own sorting methods. "Open/Save File" dialogs utilizing the shell sort the same way, though. – Corrodias – 2019-09-19T18:57:31.123

21

You can make the folders a system folder with a desktop.ini file.

Create a new text file within the folder, and set the content

[.ShellClassInfo]
InfoTip=1
[ViewState]
Mode=
Vid=
FolderType=Generic

Where InfoTip=1 sets the "tag" as "1", so you can sort numerically

Then rename the file to desktop.ini.

Then set the folder as a system folder using command prompt

attrib +s "Introduction"

Then in the root folder:

View → Choose Details → add "Comments"

And sort by Comments, now the folders will be sorted according to the "InfoTip" field in the ini file as long as the folder is marked as a system folder.

Richie Frame

Posted 2019-09-18T13:28:05.730

Reputation: 1 555

Nice. Setting the read-only attribute on the folder also works. Quickest way to create desktop.ini & set the folder attributes is to assign a custom icon via the Properties dialog. Then edit the desktop.ini file it creates. – Keith Miller – 2019-09-19T04:00:01.097

2+1 because you taught me something, but it looks too much of a hassle. I prefer the solution suggested by @JeffZeitlin. – dr01 – 2019-09-20T07:16:05.673

@dr01 it actually is not too much hassle, you can just copy and edit the ini file, and you can attrib * to all contents of a directory in one go, a dozen directories take about a minute – Richie Frame – 2019-09-20T14:20:00.280

1+1 because this answer doesn't alter paths. Answers based on renaming will break anything that expects (relies on) certain names/paths. If this happens, fixing may be a real hassle; and if you ever need to change the order then you may need to fix again. In these circumstances this answer may lead to less hassle in total. – Kamil Maciorowski – 2019-09-21T09:50:47.177

This solution, while interesting and useful, assumes and requires that 'show hidden and system files and folders' be set, which may not be considered desirable. – Jeff Zeitlin – 2019-09-25T11:10:37.317

@JeffZeitlin Actually, even though you are setting the folder to +S, it does not require explorer to show system or hidden files, as system folders with a desktop.ini file are handled differently – Richie Frame – 2019-09-25T13:35:03.410

20

Update per comments: doesn't have to be a minute apart, only creation order matters.

If you create them at least a minute apart in the order you want, you can then sort by Date Created. enter image description here

Keith Miller

Posted 2019-09-18T13:28:05.730

Reputation: 1 789

2I like that. Nice workaround. – Mr Ethernet – 2019-09-18T14:20:14.117

8The drawbacks with this method (other than waiting a minute between creating each folder) are that Date created isn't shown by default, and it would be very difficult to insert an additional folder between two existing ones. I'd go with Jeff's suggestion of numbering the folders. If you need them without numbers, copy to new folders (in order, a minute apart) at the very end (renaming doesn't seem to change either the modified- or created- times). – TripeHound – 2019-09-18T15:26:55.107

2If you copy a folder structure, it will not preserve the creation date. – Boann – 2019-09-19T02:51:00.387

3"Minute apart" does not matter. Actual creation time in the for system is precise to the second regardless of what you see in explorer. – n0rd – 2019-09-19T14:19:27.480

@n0rd: When I was testing for my response, it seemed like it mattered, even though I thought it shouldn't, knowing the nature of the value. But it seemed like it matttered at the time. I test now & indeed, as one would expect, the comparison uses the intermal precision, not display percision. – Keith Miller – 2019-09-21T00:22:30.623

1

A variation on Jeff's answer (also interferes little with default Windows behavior and is quickly accomplished): add 4,3,2,1 and 0 spaces in front of the directory names:

    Introduction
   Theoretical Background
  Methods
 Results
Conclusions

A matter of taste ;-)

Jan Doggen

Posted 2019-09-18T13:28:05.730

Reputation: 3 591

Explorer in Windows 8 deletes leading/trailing whitespace, and I'm pretty sure Windows 7 and 10 do to. – wjandrea – 2019-09-20T20:50:41.523

1@wjandrea Indeed (tested Win10). I never work from Explorer (always Total Commander) so I did not notice. – Jan Doggen – 2019-09-20T21:43:40.147

0

One thing is a real (physical) order of files / directories, the other is their logical order (sorted by name, by extension, ...) shown in File Managers.

Use such a file manager (instead of Widnows Explorer) who is able to show files in their physical order (i.e. unsorted). For example Total Commander:

enter image description here

MarianD

Posted 2019-09-18T13:28:05.730

Reputation: 2 572

10There is no guarantee that the physical order will be the order that the user wants. This also requires installing third-party software, which may or may not be an option for the querent. – Jeff Zeitlin – 2019-09-18T16:40:58.247

That is file-system dependent, and won't work on NTFS for example, see e.g. this.

– dxiv – 2019-09-19T20:38:39.627

@dxiv, interesting. Thanks! – MarianD – 2019-09-19T21:33:03.050

1

Some file managers, like Directory Opus, can do manual sorting and saves the order.

– emptyother – 2019-09-20T07:42:22.373