x

Output file attributes

Hi,

I am working on a script to get the FilePath, Filename and the created date displayed for any file which is in a Folder whose name is MRV. Let me explain in detail :

I have a Directory which has hundreds of folders and they have subfolders. One subfolder is named MRV in each folder. Now, I need to recursively go into each folder, look for MRV folder and DIR the filenames along with its Create date. I can have the output stored in a text file or in a SQL table. I tried to use the DOS command :

FOR /D %%a IN (C:\Test*) DO Dir /T:C /b /s %%a\MRV*.txt>>C:\List.txt

This gives me the complete paths for e.g as below:

C:\Test\ABC\MRV\63399862\mrv-abc-oth.txt

What I am looking for is something like :

C:\Test\ABC\MRV\63399862\mrv-abc-oth.txt 16/02/2010 14:32 PM

Can you suggest any way how the same can be done using SQL ?

more ▼

asked Feb 16, 2010 at 03:08 AM in Default

avatar image

Sagar Bhargava
438 25 26 32

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

It may be possible with SQL but not recommended as there are far better ways to do it. If you dont get DOS to complete the task then LogParser or PowerShell will be a safe bet, after that a vbscript solution. All of these are better at accessing the file system than SQL.

more ▼

answered Feb 16, 2010 at 05:55 AM

avatar image

Fatherjack ♦♦
43.7k 79 98 117

(comments are locked)
10|1200 characters needed characters left

You're using the /b switch which is suppressing output of the creation date.

more ▼

answered Feb 16, 2010 at 04:25 AM

avatar image

David Wimbush
10.3k 30 34 43

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x993
x86

asked: Feb 16, 2010 at 03:08 AM

Seen: 1109 times

Last Updated: Feb 16, 2010 at 03:08 AM

Copyright 2016 Redgate Software. Privacy Policy