Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Can't do something to a file and then delete it?

Jul
33
0
Below is part of a .btm script I've written. It's a graphic function. I need to act on PDFs in a directory. Then, I need to move them to a subdirectory. The first part is working, but, it's not moving the file. And, that's really not good, because, then, it'll just continue to act on the same files.

I know nothing about TCC variables. The documentation just confuses the hell out of me. In the shell I saw that I could create the variable MPCFILE using the "for" command. I have no idea about what more to do with this. I've tried this with a closing percentage sign around the variable, too, but, I get the same results.

cd \workflows\filetrain\00120-mcardlepdfs\
for %%I in (*.pdf) do set MPCFILE = %%I
E:\apps\callas\cli\pdftoolbox.exe -o=F:\workflows\filetrain\00120-McArdlePDFs\success\%MPCFILE E:\pdftoolboxprofiles\convert_to_grayscale_v7.3.kfpx --overwrite %MPCFILE && move %MPCFILE \workflows\filetrain\00120-mcardlepdfs\processed


Thanks!
Peter
 
Sorry. My discussion title should read "Can't do something to a file and then move it?," not delete it.
 
I'm not sure that script does what you want, or think. The line
Code:
for %%I in (*.pdf) do set MPCFILE = %%I
stands alone. If you have 1.pdf, 2.pdf, and 3.pdf, it will do
Code:
set MPCFILE=1.pdf
set MPCFILE=2.pdf
set MPCFILE=3.pdf
At this point MPCFILE will be "3.pdf". The script will continue and only 3.pdf will be processed.
If you really want to process all of *.pdf, try something like
Code:
do MPCFILE in *.pdf
   E:\apps\callas\cli\pdftoolbox.exe -o=F:\workflows\filetrain\00120-McArdlePDFs\success\%MPCFILE
   E:\pdftoolboxprofiles\convert_to_grayscale_v7.3.kfpx --overwrite %MPCFILE && move %MPCFILE \workflows\filetrain\00120-mcardlepdf\processed
enddo
 
Thanks. Well, I never know how many PDFs I have in there. There could be anywhere from 1 to 100 files. I'll try this with "do," though.
 
Thanks. Well, I never know how many PDFs I have in there. There could be anywhere from 1 to 100 files. I'll try this with "do," though.
However many there are, your original code would only process the last one. DO should work better; it's meant for multiple-line loops which is, it seems, what you want.
 
Yeh. "do" worked. Thanks a lot. But, I needed to do real work here, so, I couldn't wait. I just used cmd.exe. I have to say. TCC is cool and powerful, but, I don't have the patience to read through all the doc, which isn't very good, in my opinion. Thanks again.
 
Yeh. "do" worked. Thanks a lot. But, I needed to do real work here, so, I couldn't wait. I just used cmd.exe. I have to say. TCC is cool and powerful, but, I don't have the patience to read through all the doc, which isn't very good, in my opinion. Thanks again.

That statement is a bit puzzling to me, on several counts.
  1. You had a response (and a fix for your batch file) two hours after you posted it.
  2. If you wanted a faster response, if you had run your batch file in the Take Command batch debugger, you would have discovered the problem in a minute or two.
  3. CMD.EXE also wouldn't work with the FOR syntax you were using.
  4. I agree that if you don't want to learn a language by reading the docs, you probably shouldn't be using it. This is not unique to the TCC scripting language.
 

Similar threads

Back
Top