Combine 2 output CSVs into one?

Hello I am new to powershell and have been reading some books and blogs but need help . I can use PS in a line but having trouble with script syntax. I found a one-liner that I use in PS to produce a CSV file, it looks at all files,folders and returns the name, size , last accessed ect. I would like to see who last accessed the file (I have no idea how is accomplished or if it is possable) but I would settle for who has permissions to each folder/file. I have looked at GET-ACL and this gets me what I want but I would like the results appended to the first file in the columns to the right in the CSV?

Get-ChildItem <folder> -recurse | Get-Item |Select FullName, length, Extension, CreationTime, LastAccessTime, LastWriteTime, Attributes |Where-Object {$_.CreationTime -le “2014-02-01”} |Export-Csv <path>FileAccessTimelog2.csv

What I would like is to have one output file that shows me
FullName, length, Extension, CreationTime, LastAccessTime, LastWriteTime, Attributes, permissions1, permissions3, permissions3, blah,blah,blah

Thanks for any help,

You can. It’s a bit tricky.

The problem is that your CSV file with permissions will have many different rows for each file, depending on how many permissions the file has. That’s called a hierarchical structure (each file has multiple permissions), and CSV isn’t a good way to maintain that information. CSV is good for flat files, not hierarchical relationships. XML would be a better way to store the hierarchical relationship.

What’s the purpose of this file? If it’s to produce a report, it might be better to put the information into SQL Server Express. You could set up a table for files, and a table for permissions, and let the two relate to each other. You could then use SQL Server Reporting Services to produce some pretty awesome reports, very easily. PowerShell would just populate the database (it’s good at that), and SSRS would produce reports (it rocks at that).

(and it’s difficult to determine who last accessed a file - you’d need to be auditing that, and you’d need to scan the server’s Security event log for entries, and that would be incredibly time-consuming for PowerShell; it’s why companies like Dell make money selling auditing software that does this).

Mr Jones I am honored for your reply I have your book learn PS in a month of lunches. The purpose of the file is just for a file server rebuild and possibly some cleanup, this is the reason for who last accessed the file. You mentioned auditing and that may be something I pursue but may be overkill for this project. I think I will stay with my 2 files and deal with it.

Thanks again for your help, and your books

Well I finished testing these strings on my PC but when I went to run it on the Share I get "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters,

and the directory name must be less than 248 characters"

I did some digging and found out I will need to create a PS-Drive to shorten these paths.

Any idea how I can find out which paths are to long?