Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

powershell script

Posted on 2013-12-06
12
Medium Priority
?
354 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 71

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

609 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