Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: DOS inexpert needs help with one little command line  (Read 3437 times)

0 Members and 1 Guest are viewing this topic.

MerryToo

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Windows 10
    DOS inexpert needs help with one little command line
    « on: June 26, 2019, 11:16:28 AM »
    Hi
    I'm trying to do a forfiles command (I think).  I want to do a listing of all files in a directory with the dates.

    I usually do DIR\s\b>>  and output to a text file.  This is great, but I would like the dates.  Ideally, I'd also like to select for certain dates, too.
    I tried this, which worked great:
     Forfiles /p "a:\Directory\filename with spaces" /s /d -2006-1-3 and that worked great, though I didn't try to send the output to a text file.

    I tried it like this:
     Forfiles /p "a:\Directory\filename with spaces" /s /d -2006-1-3  /C “cmd c/ echo @fdate”

    and like this

     Forfiles /p "a:\Directory\filename with spaces" /s  /C “cmd c/ echo @fdate”

    and the command line just blinked at me, uncomprehendingly.

    I want the exact syntax to say "Computer, please print out the contents of this directory with dates but not all the other stuff."  I don't want all the <DIR>s, time, size, and other details.

    It would be great if I could command it to find contents created before a date (or between dates) and print it out but I'll take the former if I can get it.

    The end result is to take the directory list to a spreadsheet and make it searchable and sortable and be able to sort or search documents by date.

    Help?

    thanks

    Merry






    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: DOS inexpert needs help with one little command line
    « Reply #1 on: June 28, 2019, 08:57:38 AM »
    I suspect you want the contents of a folder not the properties of a single file. Also you are referencing the a: drive which is a floppy. Is this correct?

    You can try this:
    Code: [Select]
    forfiles /p c:\Directory /s /c "cmd /c echo @file,@fdate"

    I changed to drive letter to the system drive, but can be any valid drive on your system. If you redirect the output, it will be in csv format suitable for loading into Excel.

    Good luck.  8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein