Solved

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

Posted on 2016-09-05
7
21 Views
Last Modified: 2016-09-24
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
Comment
Question by:aehrenwo
  • 3
  • 2
  • 2
7 Comments
 
LVL 92

Expert Comment

by:John Hurst
ID: 41785442
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
 

Author Comment

by:aehrenwo
ID: 41785445
What if you want all subfolders and their content as well (including the path?) is it just adding /s?
0
 
LVL 92

Expert Comment

by:John Hurst
ID: 41785450
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:aehrenwo
ID: 41785462
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
 
LVL 92

Expert Comment

by:John Hurst
ID: 41785463
Yes.   DIR /s /b  Then everything is on one line. Works fine.
0
 
LVL 23

Accepted Solution

by:
NVIT earned 500 total points (awarded by participants)
ID: 41785513
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
 
LVL 23

Expert Comment

by:NVIT
ID: 41813593
Question answered by NVIT ID: 41785513
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft SharePoint Foundation 2010 and Microsoft SharePoint Server 2010 do not offer the option to configure the location of the SharePoint diagnostic trace log files during installation.  This can, however, be configured through Central Administr…
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now