Solved

powershell script

Posted on 2013-12-06
12
349 Views
Last Modified: 2013-12-14
i have found a PS script that does what i need execpt that it does not seperate the information into seperate collums in the csv file so i can sort it by last write date see below:

get-childitem e:\pf_data -rec | where {!$_.PSIsContainer} | select-object FullName, LastWriteTime, Length | export-csv -notypeinformation -delimiter '|' -path c:\pf_data_files.csv
0
Comment
Question by:Cecilpierce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 39701663
Try removing -delimiter parameter from Export-csv command..
get-childitem e:\pf_data -rec | where {!$_.PSIsContainer} | select-object FullName, LastWriteTime, Length | export-csv -notypeinformation -path c:\pf_data_files.csv 

Open in new window

0
 
LVL 70

Expert Comment

by:Qlemo
ID: 39701691
Correct. If you use a non-standard delimiter, you need to provide that on every import, unless the changed delimiter isn't the default in the importing application.
Example: In some countries, CSVs for Excel need to be separated by semi-colon instead of comma, since comma is the decimal sign.
0
 

Author Comment

by:Cecilpierce
ID: 39701797
i took that part out and the output was not in seprate collums, just a single string

E:\pf_data\03-2010 107137 Loan Mod Report.xls|"3/16/2010 1:22:05 PM"|"607744"
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 40

Expert Comment

by:Subsun
ID: 39701890
Did you run the command which I mentioned in my comment? It should give you a csv file which you can open in Excel.
0
 

Author Comment

by:Cecilpierce
ID: 39702153
Yes I ran your command. But it puts the file name and last write time and size in the same cell I need each them in seprate cells
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39702168
Can you post the output file? also how did you open the file?

Also try adding the -Encoding for file (UTF8 or ASCII)..
get-childitem e:\pf_data -rec | where {!$_.PSIsContainer} | select-object FullName, LastWriteTime, Length | export-csv -notypeinformation -path c:\pf_data_files.csv -Encoding UTF8

Open in new window

0
 

Author Comment

by:Cecilpierce
ID: 39702310
file uploaded, i opened it in excel 2010
sampleps1.xlsx
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39702734
I am still seeing delimiter as '|' in your file. Either you are not using the correct code or you are opening the wrong file. Also the output file should be csv not xlsx.
0
 

Author Comment

by:Cecilpierce
ID: 39707566
below is the code i am running, i sent you an excel file because i just copyed some of the output, i see no reason to attach a 100MB file
 
get-childitem e:\pf_data -rec |where {!$_.PSIsContainer} | select-object FullName,LastWriteTime,Length | export-csv -notypeinformation '|' -path c:\pf_data_files.csv
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39707791
You didn't remove '|' from command.. Copy paste following code to your powershell console and hit Enter..

get-childitem e:\pf_data -rec |where {!$_.PSIsContainer} | select-object FullName,LastWriteTime,Length | export-csv -notypeinformation -path c:\pf_data_files.csv

Open in new window

0
 

Author Comment

by:Cecilpierce
ID: 39709290
ahh i see the mistake now and thanks for your help! results are as expected now.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39709514
Nice!!.. If you don't have any further questions, then please don't forget to close this question..
0

Featured Post

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.

Question has a verified solution.

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

This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

688 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