script to search files with specific attribut

February 16, 2011 at 03:54:46
Specs: Windows 2003 Server
Hello All,

I have a file Server with million of files. I want a script which can provide me information in .csv file.

I want to have below informaiton in .csv file:

- Files with .xls, .doc, .txt, .ppt, .pdf extentions.
- Files must be modified between 2000 to 2001.
- .CSV file must have information about the location of file

For any instant query, please send me an email at iamshergill@<removed>

Could someone help me out over this, I would be highly obliged .

edited by moderator: Removed email address -Razor2.3

See More: script to search files with specific attribut

Report •

February 16, 2011 at 13:12:15
alright, which columes you need . I mean how the csv has to be orginazied. we can try

Subhash Chandra.

Report •

February 17, 2011 at 00:47:42
I need 3 colums:

1st Colum: Name of file with ext.
2nd Colum: Location of file
3rd Colum: Date of modification

Thanks in advance...

Report •

February 17, 2011 at 01:43:09
check this and let me know if works/errors.
@echo off

echo name of the file with extenstion,location of the file (Full Path) ,date of modification >f:\output.csv
for /f "tokens=*" %%a in ('dir /s /b *.doc *.pdf *.txt *.ppt *.xls "F:\Chandra's Library\Enter the world of hacking"') do (
echo processing file %%~na
for /f "tokens=3 delims=/ " %%j in ("%%~ta") do (
if /i %%j == 2000 echo %%~nxa , %%a , %%~ta
if /i %%j == 2001 echo %%~nxa , %%a , %%~ta
if /i %%j == 2000 echo %%~nxa , %%a , %%~ta >>f:\output.csv
if /i %%j == 2001 echo %%~nxa , %%a , %%~ta >>f:\output.csv




note: 1. replace F:\output.txt to the output file full path.
2. Replace "F:\Chandra's Library\Enter the world of hacking" with your foldername which you want to process
3. my date format is 03/29/2001 11:14 PM , if this is not your date format try to modify the code or let me know the exact date format.

the script will search for all the files in mentioned folder and will show the currnet file name on console while processing and if it finds that flie is modified in 2000 or 2001 will keep the record in csv file .

Subhash Chandra.

Report •

Related Solutions

February 17, 2011 at 02:19:17 worked.

Thanks Chandra, Thank you so much for your time and support.

If I need anything regarding scripting, I will ping you again.

Meanwhile...I have no idea about scripting...can you guide me any book to learn basic scripting?

Report •

February 17, 2011 at 02:47:03
you welcome :) happy to help.

About scripting. Its everything built into the oprating system so first you need to understand the basic commands.
open a commd prompt, type help . these are the ONLY thing we have.Read and understand help for each command individualy. Once you understand those then go for some books/tutorials..If you directly go for heavy books it will take much time and much them will be like bouncer. it has a great collection of articles on windows dos scripting. Read articles from this site as well (How tos) written by our senior expers.thoese will help you understand aspects depply.

Sorry long lession :(

Subhash Chandra.

Report •

Ask Question