Tuesday, 25 November 2014

GetFileName + powershell

#get filename in $data variable
$data = get-content "directory:\Filepath\Filename"


#iterate the collection one by one and assign item variable
foreach($item in $data)
{
#get filename in filename variable
   $Filename = [System.IO.Path]::GetFileName($item)


#write output in output file
  write-output >> directory:\Filepath\output.csv
}

No comments:

Post a Comment