22

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?

2
  • 1
    You 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) Commented Sep 20, 2019 at 13:21
  • I would like to oberserve this sequence in the file explorer.
    – Daniel
    Commented Sep 20, 2019 at 23:21

8 Answers 8

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.)

5
  • Alphabetic chapter ordinals also work well (A,B,C). Commented Sep 18, 2019 at 15:57
  • I think even Windows 7 is smart enough to sort 2 before 10. Zero-prefixing is not necessary in that case.
    – MSalters
    Commented Sep 19, 2019 at 13:00
  • 3
    Upvoted. 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
    Commented Sep 19, 2019 at 13:01
  • 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. Commented Sep 19, 2019 at 13:45
  • 1
    As 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
    Commented Sep 19, 2019 at 18:57
23

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.

6
  • 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. Commented Sep 19, 2019 at 4:00
  • 2
    +1 because you taught me something, but it looks too much of a hassle. I prefer the solution suggested by @JeffZeitlin.
    – dr_
    Commented Sep 20, 2019 at 7:16
  • @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 Commented Sep 20, 2019 at 14:20
  • 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. Commented Sep 21, 2019 at 9:50
  • 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. Commented Sep 25, 2019 at 11:10
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

5
  • 2
    I like that. Nice workaround. Commented Sep 18, 2019 at 14:20
  • 8
    The 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
    Commented Sep 18, 2019 at 15:26
  • 2
    If you copy a folder structure, it will not preserve the creation date.
    – Boann
    Commented Sep 19, 2019 at 2:51
  • 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
    Commented Sep 19, 2019 at 14:19
  • @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. Commented Sep 21, 2019 at 0:22
3

I know this is an old question, but I saw Jan Doggen's answer and wanted to help anyone that may want to use his method, but can't because Windows deletes trailing spaces. Also, I have FINALLY signed up for SE! lol, I come here like 100 times a week.

Instead of using a space, you can use this 'invisible' Unicode character --->‎ <--- (within the arrows). The cool thing about it is that programs will not delete this character whether it precedes or follows a filename, title, header, etc. Well, every program I have used it in hasn't anyways (OneNote, Excel, Windows Explorer, and so on). For example, you can have a product folder with 4 files custom sorted this way (imagine the dashes are spaces - coincidentally, SuperUser is the first website/program I have encountered that treats the invisible character as a space, haha):

---Product Overview
--Specifications
-Resources
Support

I'm really OCD though, so I think I am going to go with Richie Frame's answer, but still, this will appease most normal folks! Hope it helps :D

P.S. - Huge props to this website for teaching me about it! And if you don't have Unicode shortcuts enabled on your PC, just bookmark that site and you can easily access it through your browser whenever you need it. :)

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 ;-)

2
  • Explorer in Windows 8 deletes leading/trailing whitespace, and I'm pretty sure Windows 7 and 10 do to.
    – wjandrea
    Commented Sep 20, 2019 at 20:50
  • 1
    @wjandrea Indeed (tested Win10). I never work from Explorer (always Total Commander) so I did not notice.
    – Jan Doggen
    Commented Sep 20, 2019 at 21:43
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

4
  • 10
    There 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. Commented Sep 18, 2019 at 16:40
  • That is file-system dependent, and won't work on NTFS for example, see e.g. this.
    – dxiv
    Commented Sep 19, 2019 at 20:38
  • @dxiv, interesting. Thanks!
    – MarianD
    Commented Sep 19, 2019 at 21:33
  • 1
    Some file managers, like Directory Opus, can do manual sorting and saves the order.
    – emptyother
    Commented Sep 20, 2019 at 7:42
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.

0

An alternative to the link mentioned by TrustKibou is this blanktext website which contains a lot of Unicode whitespace characters. Hope it helps :)

1
  • 1
    Welcome to SuperUser! Please do not post link only answers, instead quote the most important parts from the linked site as it might change in the future, rendering your answer useless. Commented Jul 22, 2022 at 10:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .