Button to show files modified in last two weeks & sort desc

Hey,

I'm trying to create a button which will open a new tab from my TV series folder which contains hundreds of folders with TV shows in them and show me just the latest files (no folders) that have been downloaded in the last two weeks with the latest at the top.

Here is my button code

Go "Z:\TV Series" NEWTAB
Set COLUMNSADD=pathrel(0)
Set FLATVIEW=on,mixednofolders
Select "Modified_last_2weeks" FILTER HIDEUNSEL
Set SORTBY=-modified

Issues

  • I couldn't figure out a way to show only the last 2 weeks or so without saving a filter and using the select function above. I don't like the way this selects the files. Is there a better way, it also seems quite slow.
  • The final result isn't sorted by the modified date. It's got the oldest first and I need the latest. It doesn't work regardless of whether I put a minus '-' before the column name.
  • Any other suggestions on how to optimize this button would be much appreciated.

Any help would be much appreciated :smiley:

You could probably replace all but the last line with a single Find command, which runs on the folder and uses your Modified_last_2weeks filter. Unless you need the result to be "live" and show newly added files/folders, unlike a Find-results snapshot.

For the last line, it's the SORTREVERSE argument which reverses the sort-order, not placing "-" before the column name. (But you don't need that if you go the "Find" route. Instead, have the comment output to a named File Collection, then save a folder format for that collection using the sort-order you want.)

Thanks Leo, much appreciated. Wow, it seems over complicated for what is a simple query. After an hour of messing around, I've only come up with the following and it does nothing other than display the find window at the bottom. Do you I have to include the search location within the predefined search if Im using a predefined search?

Find NAME Modified_last_2weeks FILTER SHOWRESULTS tab

Yes, if the Find command isn't given all the info it needs then it won't be automatic. You need to specify the folder to search. You can use {sourcepath} if you want to search the current folder, but your original example had a hardcoded path so I assume that's what you want here as well.