Import CSV File Demo
Import the latest CSV file from a UNC path
# create reference to UNC path
new-psdrive -Name "csvsource" -Root "<unc path>" -PSProvider FileSystem
# get the latest file
$latestfile = get-childitem -Path "csvsource:" | sort-object lastwritetime -Descending | select-object -First 1
# check type; returns System.IO.FileInfo
$latestfile | get-member
# send to Excel
$latestfile | select-object -Property Name,Length,LastWriteTime | Export-Excel -Now
# get full path to source file
$sourcefile = join-path "csvsource:" $latestfile.Name
# get type; returns String
$sourcefile | get-member
$sourcefileinfo = get-item $sourcefile
# get type; returns System.IO.FileInfo
$sourcefileinfo | get-member
copy-item $sourcefile -Destination "C:\temp"
get-childitem "c:\temp"
get-help copy-item -online
Comments
Post a Comment