To Access file details in DOS
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
Software
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
by sujishtl Accepted solution
by cg it Accepted solution
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.
by Member 25348569 Accepted solution
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 , 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...
This discussion is closed to new replies.
Sort by Trending