|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
DOS Dir - listing of full path and timestamp
Hi, (Apologies, I'm sure I'm not the first person to raise this question but so far in my searches haven't found a good answer). I would like to output a listing per line of filename (including full path) and 'last updated' timestamp. e.g: Code:
Z:\dir1\file1.txt 01/02/2010 10:43 z:\dir1\file2.txt 12/04/2010 09:30 z:\dir1\dir2\file3.txt 26/05/2010 13:01 z:\dir1\dir2\file4.txt 26/05/2010 13:02 I expect 1000+ files to be reported in my real scenario. The ultimate aim is to export to Excel and sort by date. I had hoped to use the DOS DIR command. Thanks in advance for any help. ---------- Post updated at 12:37 PM ---------- Previous update was at 06:10 AM ---------- Come on folk - it can't be that hard... |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Hi, what have You tried Yourself?
I'm afraid You can't do that with the dir command alone. Do You mean DOS or NT (command.exe or cmd.exe)? But if You combine it with the "FOR /F" You can extract the needed columns and order them as You want. Have a look at SS64.com Command line reference, an excellent site for explaining some of the most common scripting languages. I'm not sure about the full path, maybe You would have to combine the command by using dir /s to get the directories, or perhaps tree. I'm sure it's not THAT hard to find a command to create that list. ![]() /Lakris |
| The Following User Says Thank You to Lakris For This Useful Post: | ||
GM_AIX (09-10-2010) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Lakris,
Thank you - it is helpful just to have had it confirmed that I haven't missed a DIR switch. It just feels frustrating that output displayed through the GUI Windows Search program can't be output to file and can't be directly replicated through DIR (I'm using CMD.exe by the way). I'm sure that lots of people have had the same requirement but my initial Google searches didn't find anything ideal so I was hoping that someone here would have a quick answer. I'll go back to searching or work something out for myself. GM_AIX ---------- Post updated at 04:44 AM ---------- Previous update was at 04:43 AM ---------- Oh, one extra point... In my particular case, the directory structure is in a Clearcase stream, so if anyone happened to know a ClearTool solution, that would be a viable alternative on this occasion. |
|
#4
|
|||
|
|||
|
No problems!
I often get frustrated about the shortcomings of "DOS". When I have a complicated script problem it often results in tweaks and workarounds and temporary files, fooling the shell with any number of %%% and """" (where nobody actually knows why it works, it just does, sometimes... also depending if it's in a bat/cmd-file or on an interactive command line) using dozens of programs, that so easily could have been solved with bash alone, possibly with a helper such as sort/grep/find/cut or whatever. Good Luck! /L PS Have a look at the "FOR /R" construct. "http://ss64.com/nt/for_r.html" Can that help? |
| Sponsored Links | |
|
|
#5
|
||||
|
||||
|
DIR /O:A will sort the list by last access time with the earliest time first. I presume you could then sort the files by name if rerquired after exporting them to Excel.
And DIR /? will give you all the options. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
You don't mention Windows or Excel versions. Assuming XP. This must be done in a Batch File (.bat). The first script is your exact requirement. The second script puts the timestamp in front of the filename which is more readable. Code:
@echo off REM list files with timestamp REM Filename first then timestamp for /R %%I in (*.*) do @echo %%~dpnxI %%~tI @echo off REM list files with timestamp REM Timestamp first then name for /R %%I in (*.*) do @echo %%~tI %%~dpnxI Just for interest, there are techniques available from Excel if you don't mind a bit of VB programming. For example (but do check your Excel and Windows version and re-search the KB). XL: How to Put Folder Contents into a Worksheet Last edited by methyl; 09-13-2010 at 12:50 PM.. Reason: typo |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Just listing size, timestamp & name of files in a directory | Jazmania | Shell Programming and Scripting | 4 | 01-25-2010 01:21 PM |
| Listing files with full path | r_sethu | UNIX for Dummies Questions & Answers | 5 | 06-15-2009 02:56 AM |
| getting full path from relative path | polypus | Shell Programming and Scripting | 4 | 03-25-2007 12:08 PM |
| Full Directory Listing... | B14speedfreak | UNIX for Dummies Questions & Answers | 5 | 05-11-2006 08:06 AM |
| Timestamp in directory listing | vijashok | UNIX for Dummies Questions & Answers | 2 | 10-06-2005 10:03 AM |
|
|