|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
batch to rename files
Hi,
We're using an automated work flow system to process files for print, at one point it has to send files to another program for further processing. To do this the files have to be re-named from a "workticket number" to a "job type" code and then afterwords, renamed back to the "workticket number". So I was thinking a batchscript1 could re-name the file for example 12345.pdf to businesscard.pdf, and write "12345.pdf" to a name.txt file. Then when processing is done, batchscript 2 could rename businesscard.pdf to the contents of name.txt (12345.pdf) I've tried a few alternatives, but no luck yet, having trouble especially redirecting info to the "rename" command. Any tips or advice would be appreciated. Thanks Steven hook.ste***@gmail.com wrote:
Show quote > Hi, What exact OS and what have got so far?> We're using an automated work flow system to process files for print, > at one point it has to send files to another program for further > processing. To do this the files have to be re-named from a > "workticket number" to a "job type" code and then afterwords, renamed > back to the "workticket number". > So I was thinking a batchscript1 could re-name the file for example > 12345.pdf to businesscard.pdf, and write "12345.pdf" to a name.txt > file. > Then when processing is done, batchscript 2 could rename > businesscard.pdf to the contents of name.txt (12345.pdf) > I've tried a few alternatives, but no luck yet, having trouble > especially redirecting info to the "rename" command. > Any tips or advice would be appreciated. > Thanks > Steven > I'd create a batch for the rename instead of only storing in name.txt If there are problems while processing it might also be better to have a copy instead of renaming. BTW why have you addressed the group alt.msdos.batch twice -- Greetings Matthias On Mar 14, 12:57 pm, Matthias Tacke <Matth***@Tacke.de> wrote:
Show quote > hook.ste***@gmail.com wrote: That was accidental :(> > Hi, > > We're using an automated work flow system to process files for print, > > at one point it has to send files to another program for further > > processing. To do this the files have to be re-named from a > > "workticket number" to a "job type" code and then afterwords, renamed > > back to the "workticket number". > > So I was thinking a batchscript1 could re-name the file for example > > 12345.pdf to businesscard.pdf, and write "12345.pdf" to a name.txt > > file. > > Then when processing is done, batchscript 2 could rename > > businesscard.pdf to the contents of name.txt (12345.pdf) > > I've tried a few alternatives, but no luck yet, having trouble > > especially redirecting info to the "rename" command. > > Any tips or advice would be appreciated. > > Thanks > > Steven > > What exact OS and what have got so far? > > I'd create a batch for the rename instead of only storing in name.txt > If there are problems while processing it might also be better to have > a copy instead of renaming. > > BTW why have you addressed the group alt.msdos.batch twice > > -- > Greetings > Matthias I'm using M$ 2000 server. so when the PDF arrives in the folder the batch is initiated by Oris Hotfolder Manager, the bat: copy "n:\preps\in\job library\i-gen\bc\double sided\90x50\*.job" "n: \preps\in" now here are some options I tried for line 2: dir "n:\preps\in\job library\i-gen\bc\double sided\90x50\*.pdf" > "n: \preps\in\job library\i-gen\bc\double sided\90x50\name.txt" copy "n:\preps\in\job library\i-gen\bc\double sided\90x50\*.pdf" %tmp% > "n:\preps\in\job library\i-gen\bc\double sided\90x50\name.txt" ORIS also renames the pdf to 90x50.pdfThen the .job file initiates the processing of the PDF by Preps, and all the output files land in "n:\preps\out" When the PDF file arrives there, Oris Hotfolder Manager will see them and suck them initiate the second batch script that will do something like del "n:\preps\out\*.log" del "n:\preps\out *.job" Next line to do something like: ren "n:\preps\out\*.pdf" < "n:\preps\in\job library\i-gen\bc\double sided\90x50\name.txt" more "n:\preps\in\job library\i-gen\bc\double sided\90x50\name.txt" | ren BUT I can't figure out how to pipe info to ren or how to direct from a file to ren. I know there are big holes in where I am right now ... that's why I'm posting, I don't know what I'm doing, so looking for help. Steven On 14 Mar 2007 04:26:30 -0700, hook.ste***@gmail.com wrote:
>BUT I can't figure out how to pipe info to ren or how to direct from a You can't.>file to ren. There two batch file may help (untested). The first can echo the name of a pdf file into the text file @echo off cd /d "n:\folder" for %%a in (*.pdf) do >file.txt echo %%~nxa copy file wherever The second can restore the name of the pdf file, and move it to where you want it. The both assume only one pdf file exists at a time. @echo off cd /d "n:\folder" set /p var=<file.txt ren *.pdf "%var%" move "%var%" "n:\destination folder" hook.ste***@gmail.com wrote:
Show quote > Hi, Q: "What exact OS?"> We're using an automated work flow system to process files for print, > at one point it has to send files to another program for further > processing. To do this the files have to be re-named from a > "workticket number" to a "job type" code and then afterwords, renamed > back to the "workticket number". > So I was thinking a batchscript1 could re-name the file for example > 12345.pdf to businesscard.pdf, and write "12345.pdf" to a name.txt > file. > Then when processing is done, batchscript 2 could rename > businesscard.pdf to the contents of name.txt (12345.pdf) > I've tried a few alternatives, but no luck yet, having trouble > especially redirecting info to the "rename" command. > Any tips or advice would be appreciated. A: "I'm using M$ 2000 server" First things first. alt.msdos.batch is for batch discussions relating to MSDOS/Win9x/ME systems. For anyone not aware, there are groups specifically for NT/2K/XP related batch discussions. Here are 2 such groups... <news:alt.msdos.batch.nt> <news://news.microsoft.com/microsoft.public.win2000.cmdprompt.admin> And if you don't have access to those, try... <http://groups.google.com/groups?as_ugroup=alt.msdos.batch.nt> Now, keeping the task to information provided in this post, the following might help. I would create this batch in the .pdf folder. This batch first renames all .pdf files to .old extension. Then each .old file is processed by renaming it to the "job" name, processed, then renamed back to the original file name. If for some reason the batch process is interrupted, all files still named .old are unprocessed. Simply restart the batch an it will resume processing where it left off. Before you begin though, make sure there are no files named .old (you can use another extension if you prefer). @echo off if exist *.old goto :resume ren *.pdf *.old :resume for %%? in (*.old) do call :proc "%%?"echo All processing is complete. goto :eof :proc echo Processing %~n1.jpg . . .ren %1 12345.jpg prog 12345.jpg ren 12345.jpg "%~n1.jpg" echo done. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
|||||||||||||||||||||||