i need a small script to show the
1. top 5 latest modified files and 5 folders in the selected directory or drive
2. bottom 5 files and folders in separate window.
i want to display them in separate tabbed window. i have hundreds of files and folders in the directory D. whenever i copy files or folders, it becomes difficult to scroll through all the folders or files.
please help.
how to display top five modified folders and files
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
how to display top five modified folders and files
Last edited by kotlmg on 21 Aug 2012 16:09, edited 1 time in total.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Show last 5 files or folders in a new tab
Please would you mind to use more clever subject lines for your threads
so that others who may need such function too are able to find it better.
so that others who may need such function too are able to find it better.
-
Stefan
- Posts: 1360
- Joined: 18 Nov 2008 21:47
- Location: Europe
Re: how to display top five modified folders and files
I don't know if i understood your work flow.kotlmg wrote:i need a small script to show the
1. top 5 latest modified files and 5 folders in the selected directory or drive
2. bottom 5 files and folders in separate window.
Show the top 5 files in an separate window is not possible right now i think.
Perhaps one day in future when there is something like "scratch panel/virtual folder"?
Here are the commands to sort and select some files.
Maybe this can be an start for you?
Code: Select all
//sortby [column], [order (|a|d|clk)]
sortby modified;
//sel [position/pattern], [count], [startfromtop]
//sel +, 3; // Select 3 items starting with the currently focused one.
sel +, 5; // Select 5 items , startfromtop
.
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
Re: how to display top five modified folders and files
i have tested your code. the present code is selecting five files/folders from the selected files/folders. i don't want to select any file/folder. i want the latest five modified folders/files to be selected. i want the code to bring the latest modified 5 folders/files automatically.
-
highend
- Posts: 14946
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: how to display top five modified folders and files
Something like this?
Code: Select all
$maxEntries = 5; // How many file(s) & folder(s) should be shown
$replaceItems = <<<>>>
$RECYCLE.BIN|
System Volume Information|
>>>;
tab("new");
sortby "Modified", "d";
$i = 1;
$j = 1;
$filter = quote($maxEntries . " latest entries") . " ";
sel f;
$files = get("SelectedItemsNames", "|");
$countFiles = get("CountSelected");
if($countFiles < $maxEntries) { $maxEntriesFiles = $countFiles; } else { $maxEntriesFiles = $maxEntries; }
while($i <= $maxEntriesFiles) {
$filter = $filter . quote(gettoken($files, $i, "|")) . "|";
$i++;
}
sel i;
$folders = get("SelectedItemsNames", "|");
$countFolders = get("CountSelected");
foreach($item, $replaceItems, "<crlf>") {
if($item == "") { break; }
if(strpos($folders, $item) != -1) {
$folders = replace($folders, $item, "");
}
}
if($countFolders < $maxEntries) { $maxEntriesFolders = $countFolders; } else { $maxEntriesFolders = $maxEntries; }
while($j <= $maxEntriesFolders) {
$filter = $filter . quote(gettoken($folders, $j, "|")) . "|";
$j++;
}
sel;
filter $filter;
One of my scripts helped you out? Please donate via Paypal
-
kotlmg
- Posts: 321
- Joined: 30 Jun 2010 17:14
Re: how to display top five modified folders and files
marvellous code. this is what i wanted. is it possible to add user input for number of folders and files without physically restricting it to 5. thanks a lot again.
lot many thanks again.
i have modified the code to my requirement as follows.
it is working.
lot many thanks again.
i have modified the code to my requirement as follows.
Code: Select all
// $maxEntries = 5; // How many file(s) & folder(s) should be shown
$maxEntries = input("Enter no of files or folders to be displayed");
$replaceItems = <<<>>>
$RECYCLE.BIN|
System Volume Information|
>>>;
tab("new");
sortby "Modified", "d";
$i = 1;
$j = 1;
$filter = quote($maxEntries . " latest entries") . " ";
sel f;
$files = get("SelectedItemsNames", "|");
$countFiles = get("CountSelected");
if($countFiles < $maxEntries) { $maxEntriesFiles = $countFiles; } else { $maxEntriesFiles = $maxEntries; }
while($i <= $maxEntriesFiles) {
$filter = $filter . quote(gettoken($files, $i, "|")) . "|";
$i++;
}
sel i;
$folders = get("SelectedItemsNames", "|");
$countFolders = get("CountSelected");
foreach($item, $replaceItems, "<crlf>") {
if($item == "") { break; }
if(strpos($folders, $item) != -1) {
$folders = replace($folders, $item, "");
}
}
if($countFolders < $maxEntries) { $maxEntriesFolders = $countFolders; } else { $maxEntriesFolders = $maxEntries; }
while($j <= $maxEntriesFolders) {
$filter = $filter . quote(gettoken($folders, $j, "|")) . "|";
$j++;
}
sel;
filter $filter;
XYplorer Beta Club