question

Sagar Bhargava avatar image
Sagar Bhargava asked

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 ?

sqlscript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fatherjack avatar image
Fatherjack answered

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.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Wimbush avatar image
David Wimbush answered

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

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.