File properties

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
igorek83
Posts: 1
Joined: 20 May 2011 09:15

File properties

#1 Post by igorek83 » 20 May 2011 09:26

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.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: File properties

#2 Post by Ed Dyreen » 20 May 2011 09:58

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

xl1000
Posts: 10
Joined: 01 Feb 2011 06:10

Re: File properties

#3 Post by xl1000 » 20 May 2011 13:44

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


Post Reply