Page 1 of 1

File properties

Posted: 20 May 2011 09:26
by igorek83
Hello..

I need help to create a script that will do the following:
1. Retrieve a file creation date and time from all the files in a specific folder and save the data to a .txt file.
2. (optional) Archive the .txt file (rar or zip).
3. (optional) Send the file via a VPN to other machine public folder.

The operating system is windows XP.
I don't have much experience in creating batch scripts but I do have programming knowledge in JAVA/C# but i'm thinking that a batch script will be much more preferable than a program.

Thanks.

Re: File properties

Posted: 20 May 2011 09:58
by Ed Dyreen
1. Retrieve a file creation date and time from all the files in a specific folder and save the data to a .txt file.

I think it can be done with the dir /? command .

2. (optional) Archive the .txt file (rar or zip).

Whhhza I need to reboot :evil:
use 7zip

Re: File properties

Posted: 20 May 2011 13:44
by xl1000

Code: Select all

@echo off
setlocal
SET target=dir_date.txt

IF EXIST %target% DEL /Q %target% >nul
echo.
echo == ( 1 )
echo.
FOR /F %%i IN ( 'dir /b' ) DO CALL :format %%i
echo.
echo == ( or )
echo.

dir /c
echo ==

goto :eof

:format
ECHO %~t1 - %1>>%target%
ECHO %~t1 - %1