Question

Locked

To Access file details in DOS

By sujishtl ·
I need to get the file created date and time and assign it to variables in DOS for all files in a folder .Is it possible ?Can somebody suggest a solution.
Thanks in advance
Sujish

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

well.......

by CG IT In reply to To Access file details i ...

if you know the path just do a CD [change directory] or do a dir at the command prompt [C:]

example c:\file name or c:\directory name\file name and the date the file was created would be listed.

Collapse -

Not sure why you would want to do this but...

by neilb@uk In reply to To Access file details i ...

For %i in (*.*) do set %i=%~ti

The above command will create a DOS environment variable using the filename as the variable's name with the variable's value set to the file date and time.

To use it from within a batch file,
For %%i in (*.*) do set %%i=%%~ti

The filespec can include the path but to avoid the variable name including the path, use
For %i in (c:\testit\*.*) do set %~nxi=%~ti

Typing Set <cr>, the output will be of the form

testfile.txt=05/04/2007 17:40

If you have a lot of files, you will run out of environment space PDQ.

Neil :)

Please, if you read this, tell me what you want to do...

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums