Reputation: 55
I really need some help as my script works but makes a mess
@echo off
set OutputFilePath=trimmed
pushd
for /r %%i in (*.pdf) do (
pdftk "%%i" cat 1 output "%OutputFilePath%%%~ni-1stpage%%~xi"
)
popd
Can someone help to correct my script as follows
It can also by something brand new also in PowerShell or Python
Upvotes: 0
Views: 961
Reputation: 16266
If you wanted to try this in PowerShell, the following might work.
Get-ChildItem -File -Path 'C:\src\t' -Filter '*.pdf' |
ForEach-Object {
pdftk $_.FullName cat 1 output "C:\pdf\new\dir\$($_.BaseName)-1stpage$($_.Extension)"
}
Upvotes: 0
Reputation: 55
Thank Lit for your tips, worked with that to get the answer. I created the following script
@echo off
set OutputFilePath=<output path>
pushd
for %%i in (*.pdf) do (
pdftk "%%i" cat 1 output "%OutputFilePath%%%~ni-1stpage%%~xi"
)
popd
Upvotes: 1