Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 35
  • Last Modified:

Command prompt DIR - get specific fields of information (SharePoint 2007 site)

I have a SharePoint 2007 site we are migrating and I am trying to extract all folders and files within a map network drive for the site using the command prompt and export a text file.

The fields I want to display are the full field path, the last modified date of the file, and the content owner.

Preferably separated by a comma or other character to parse after export.

Any suggestions?

Regards,

Adam
0
aehrenwo
Asked:
aehrenwo
  • 3
  • 2
  • 2
1 Solution
 
John HurstBusiness Consultant (Owner)Commented:
Open cmd.exe and type DIR /?

Full path, last modified date, owner and more are all available.

DIR *.* > File.txt puts the output in a file for you.
0
 
aehrenwoAuthor Commented:
What if you want all subfolders and their content as well (including the path?) is it just adding /s?
0
 
John HurstBusiness Consultant (Owner)Commented:
If that is all you wanted, just add /s

But you can add other parameters to get more information in the same pass for a file.

Run a few tests interactively (not to a file) to see how it works.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
aehrenwoAuthor Commented:
The only issue with this method is it shows the path and then all of the files within. is there  a way to display the path on the same line as the actual files themselves?

01/01/2016 X:\systems\samplefile.doc  <Owner>

versus

x:\systems\

01/01/2016 12:15 AM <DIR> 1,000  samplefile.doc
0
 
John HurstBusiness Consultant (Owner)Commented:
Yes.   DIR /s /b  Then everything is on one line. Works fine.
0
 
NVITCommented:
Make a FileInfo.bat file of this, which  returns a listing in the format:
c:\local\acadfuns.lsp,02/24/2016,domain\user1
c:\local\testfile.txt,03/23/2016,domain\user2

Open in new window


Adjust the set dirroot= line to your needs.  i used c:\local. If you want to do the whole c:\, use c:\.

@echo off
setlocal enabledelayedexpansion

set dirroot=c:\local

FOR /r "%dirroot%" %%A in (*) DO (
  for /f "tokens=1,5" %%a in ('dir /tw /q "%%A"^|find "/"') do (set sOwner=%%b& set sModified=%%a)
  echo %%~fA,!sModified!,!sOwner!
)

Open in new window


Open a CMD window.

To see the results:
FileInfo.bat

Open in new window


To send the results to a CSV file results.csv:
FileInfo.bat>results.csv

Open in new window

0
 
NVITCommented:
Question answered by NVIT ID: 41785513
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now