List Files in Date Created Order

General questions about NeoBook

Moderator: Neosoft Support

Locked
ajhunt
Posts: 266
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom
Contact:

List Files in Date Created Order

Post by ajhunt »

Hi all, anyone got any suggestions on how to list 3 different folders containing images and gifs and mp4s into a single file in date creation order? - I have been trying with the Dir command and can do single folder but am really wanting to combine all 3 lists into a single list in date creation order containing the date and time and filename (e.g. 04/04/2018 09:11 filename.jpg) Folder1 with .jpgs, Folder2 with .gifs and Folder3 with .mp4s all into a single text file in date creation order. A little stumped here lol. Thanks for any suggestions.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: List Files in Date Created Order

Post by Gaev »

ajhunt:
I have been trying with the Dir command and can do single folder but am really wanting to combine all 3 lists into a single list in date creation order containing the date and time and filename (e.g. 04/04/2018 09:11 filename.jpg) Folder1 with .jpgs, Folder2 with .gifs and Folder3 with .mp4s all into a single text file in date creation order.
1) redirect the output of your first dir command to a file e.g. ...

Code: Select all

dir {your command parameters and switches go here} > c:\filelist.txt
2) redirect the output of your subsequent dir commands to be appended to the same file e.g. ...

Code: Select all

dir {your command parameters and switches go here} >> c:\filelist.txt
3) sort the file (using the sort command) e.g. ...

Code: Select all

sort" /+16 c:\filelist.txt /O c:\sortedfilelist.txt
Note:

1) do not include the { and } in the dir commands above

2) the /+16 in the sort command tells it to sort the lines using the first 16 characters in each line (assuming they are of the form 04/04/2018 09:11)

3) if you use the NeoBook Run command for each dir and sort dos-command, make sure you specify the "wait" option to ensure the commands are executed in the intended order; alternatively, Run a single .bat file with these commands in it.
ajhunt
Posts: 266
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom
Contact:

Re: List Files in Date Created Order

Post by ajhunt »

Hi Gaev, thanks for the reply. I thought I had deleted the post after I had posted it lol. I found a way but yours is a cleaner way so again thankyou for your experience. Using the /OD switches worked great and fast enough too. Thanks Gaev as your always a great source of help and advice and always appreciated.
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: List Files in Date Created Order

Post by virger »

Try this:
If have a problem with this info:
1)
File_Bame :Zone.Identifier:$DATA
look this
https://askubuntu.com/questions/65101/w ... event-them

2)
dir *.EXT1 /R /OD > FILE.txt
dir *.EXT2 /R /OD >> FILE.txt
dir *.EXTn /R /OD >> FILE.txt

3)
Depurar el FILE.txt
COSTA RICA
PURA VIDA
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: List Files in Date Created Order

Post by virger »

Depurar FILE.txt

Code: Select all

FileLen "l1.txt" "[sz]"
loop "1" "[sz]" "[c]"
:Ini
    fileRead "l1.txt" "[c]" "[Lin]"
    substr "[Lin]" "1" "1" "[ch]"
    SearchStr "[ch]" "0123456789" "[ps]" ""
    if "[Ps]" "=" "0"
        FileDelLine "l1.txt" "[c]"
        if "[c]" "=" "[sz]"
            exit "" ""
        endif
        math "[sz]-1" "" "[sz]"
        gotoline "Ini"
    endif
endloop
exit "" ""
COSTA RICA
PURA VIDA
ajhunt
Posts: 266
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom
Contact:

Re: List Files in Date Created Order

Post by ajhunt »

Thank you so much Virger, will definately use the sorting code - thanks so much for your time and efforts supporting yet another NeoBook users. Really appreciated Virger.
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: List Files in Date Created Order

Post by Gaev »

ajhunt, virger:

A simpler way to exclude the extraneous lines from the dir command is to ...

Code: Select all

dir c:\path\to\giffolder\*.gif | find  ".gif" > c:\filelist.txt
dir c:\path\to\jpgfolder\*.jpg | find  ".jpg" >> c:\filelist.txt
dir c:\path\to\mp4folder\*.mp4 | find  ".mp4" >> c:\filelist.txt
sort" /+16 c:\filelist.txt /OD c:\sortedfilelist.txt
ajhunt
Posts: 266
Joined: Sat Apr 23, 2005 2:33 pm
Location: United Kingdom
Contact:

Re: List Files in Date Created Order

Post by ajhunt »

Many thanks Gaev, always a better way lol - thank you yet again :) PM'd you Gaev.
Locked