Reputation: 614
I"m trying to run a convert all of my .ipynb files within a directory to .pdf using this command:
ipython nbconvert {FILE} --to pdf
where {FILE} is the filename.
I'm trying to find all .ipynb files within a directory and its subdirs and then apply the above command to each file using powershell.
Looking around stackoverflow I put together the first part, but I"m not sure about the second part:
Get-ChildItem C:\Users\yomog\Desktop\FAST AI\courses-master *.ipynb -recurse |
Foreach-Object {
ipython nbconvert {FILE} --to pdf
}
Upvotes: 0
Views: 207
Reputation:
You need to quote pathes containing spaces
Get-ChildItem "C:\Users\yomog\Desktop\FAST AI\courses-master *.ipynb" -Recurse |
Foreach-Object {
& ipython nbconvert "$($_.FullName)" --to pdf
}
Upvotes: 1
Reputation: 389
The object being returned to the pipeline can be accessed as $_
. Since it will be returning IO.FileInfo objects your best bet is probably to replace {FILE}
with $_.FullName
Upvotes: 1