I am trying to iterate through a list of files on disk, run a command for each file using VIPS / ImageMagick, then output a file and move it to to a different directory. I can't seem to get the commands to work together.
Why are the variables $_Basefile not working in this command?
Individual Commands for VIPS
vips tiffsave input_file.tif output_file.tiff --args[...]
PowerShell Commands
ls | %{vips tiffsave $_BaseFile.tif $_BaseFile.tiff --compression jpeg --Q=90 --whateverelse }
Update: The answer marked correctly below worked. Thumbs up for the well explained reasons why it didn't work! The proper command is:
GCI -File -Filter "*.tif" | %{vips tiffsave "$($_.FullName)" "$($_.BaseName).tiff" --compression jpeg --Q=90}
Get-ChildItem -File|Get-Member
or short ls -File|gm
$_.FullName
and $_.BaseName
you needSo try:
GCI -File -Filter "*.tif" | %{vips tiffsave "$($_.FullName)" "$($_.BaseName).tiff" --compression jpeg --Q=90}
ls, dir, gci are all aliases of the Get-ChildItem
cmdlet