Solved

powershell script

Posted on 2013-12-06
12
343 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
  • 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 68

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
 
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
Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Some time ago I faced the need to use a uniform folder structure that spanned across numerous sites of an enterprise to be used as a common repository for the Software packages of the Configuration Manager 2007 infrastructure. Because the procedu…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
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…

762 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

23 Experts available now in Live!

Get 1:1 Help Now