How to Sort current folder by modified date via script/bat.

Discuss anything related to portable freeware here.
Post Reply
Message
Author
Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

How to Sort current folder by modified date via script/bat.

#1 Post by Marc »

Basically I want to replicate the same function of "Sort by" in Windows, but instead of manually clicking:
right button > Sort by > Modified date
run a script stored in the same folder for which I want to sort folders and files (I don't mind that folders are listed first).

User avatar
Midas
Posts: 6725
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: How to Sort current folder by modified date via script/b

#2 Post by Midas »

If you mean to go via CLI, this will do it nicely:
  • Code: Select all

     dir /OD /TW
    [/size]
    • (meaning Order by Date, use Time of last Write; an optional "/S" might be needed for inclusion of Sub-folders).
If you meant to interact with the GUI, I'm outta here... ;)

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: How to Sort current folder by modified date via script/b

#3 Post by Marc »

Thank you Midas!!
I must be doing something wrong...
I created a bat file with the code in a test folder with some files and nothing happened. I manually refreshed the folder without result.
I have been researching in autohotkey forums but it seems the solutions are language dependent.

User avatar
Midas
Posts: 6725
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: How to Sort current folder by modified date via script/b

#4 Post by Midas »

Care to share your batch code? :?

Nothing is supposed to happen here: it just generates a listing of the filesystem objects sorted accordingly.

If you want to capture that listing, you'll have to pipe it into a text file with something like "> output.txt".

Adding an optional "\B" might be called for to do away with the extra info...

Marc
Posts: 165
Joined: Sun May 15, 2011 6:06 pm

Re: How to Sort current folder by modified date via script/b

#5 Post by Marc »

So far what I have found
https://autohotkey.com/board/topic/5579 ... lder-view/
Unfortunately I haven't managed to ge it to work...
Midas wrote:Nothing is supposed to happen here: it just generates a listing of the filesystem objects sorted accordingly.
Rather than a list I'd get explorer to open with a given type of sorting.

I apologize for the late response (had a power outage).

User avatar
Midas
Posts: 6725
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: How to Sort current folder by modified date via script/b

#6 Post by Midas »

No can do. And, as said previously, I'm outta here... :|

Post Reply