Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате |
Форум программистов > Perl: Общие вопросы > How to sent file ! |
Автор: viktorijakup 5.9.2008, 13:35 | ||
Hello !!! This script runs perfectly, but in this script i must direct path. I would like run script in all directoties and don't rewrite path in script every time. I have a lof of files in different directories: Examples: D:\conv\ESSD\YJCIS\YJCIS14136\TOC.doc; D:\conv\ESNL\APNUM\APNUM2185\vvvv.pdf; D:\conv\ESME\BULSCI\BULSCI2303\rrr.tex... .........and so on.... Constant path is "D:\conv", doesn't change %%%% For example: I must send from D:\conv\ESSD\YJCIS\YJCIS14136\ selective "TOC.doc" file to X:\sgml_db\ESSD\YJCIS\YJCIS14136\ Constant path is "X:\sgml_db", doesn't change, the same "\ESSD\YJCIS\YJCIS14136\" catalogue name. and rename "TOC.doc" to "MMC1.doc"; if i have "vvvv.pdf" I rename "MMC1.pdf" and so on..... My script must undestand "paths", I want sent file from directory to the same directory, only change "D:\conv\" to "X:\sgml_db\" path. What i must add to this script !!???
Thank you ! Viki |
Автор: shamber 5.9.2008, 14:50 | ||||
Add this two file in one directory. Change $oldDir and $newDir test.pl
DirScanRecurce.pm
And Try $newDir.$cat."/MMC".$hash->{$type}.$type this name of new file. |
Автор: viktorijakup 5.9.2008, 16:50 |
Hello !!! You are nice, you are genius !!!! You script runs more good, than I expect !!! But I need to send one file in one script run. If I open folder: "D:\conv\yjcis\yjcis14136\" and selective one file "bbc.doc", this script must sent this file to X:\sgml_db\yjcis\yjcis14136\ and rename to MMC1.doc. The same path in "red color". And When I choose other directory from "D:\conv\ESNL\PLA\PLA18045\" and selective file "supporting.pdf", this script must sent this file to X:\sgml_db\ESNL\PLA\PLA18045\ and rename to MMC1.pdf. |
Автор: sir_nuf_nuf 6.9.2008, 23:00 | ||
viktorijakup, how do you plan to run you script ? from any directory or only from directory containing file to be copied? In other words: is directory "D:\conv\yjcis\yjcis14136\" current when you execute script? if so, you may use following script:
BTW, why did you chose this forum? there are a lot of english perl forums but you chose russian =) |
Автор: shamber 8.9.2008, 09:13 |
![]() ![]() |
Автор: viktorijakup 8.9.2008, 12:43 |
Hi, sir_nuf_nuf ! Thank you for answer. When I run your script, I get error:
[2] Compilation failed in require at d:\bin\perl\lib/DynaLoader.pm line 25. [3] Begin failed -- compilation aborted at d:\bin\perl\lib/DynaLoader.pm. [4] Compilation failed in require at d:\bin\perl\site\lib/Win32.pm line 13. [5] Begin failed -- compilation aborted at d:\bin\perl\site\lib/Win32.pm line 42. [6] Compilation failed in require at d:\bin\perl\lib/cwd.pm line 345. [7] Begin failed -- compilation aborted. ![]() |
Автор: viktorijakup 8.9.2008, 13:53 |
Hi, shamber !!! Nice to see you !!! ]Correction : I open folder and stand on file.
[2] Sent file. For it, i must have script.....!!!! |
Автор: sir_nuf_nuf 8.9.2008, 14:33 | ||||||
It seems you have incompatible versions of your perl libraries.. I know two solutions: 1) Update your perl to 5.8.8 (you can download it from active state site) 2) Do not use Cwd module. Patch my script and substitute
with
|
Автор: viktorijakup 9.9.2008, 08:40 |
Hi, sir_nuf_nuf !!! Your scripts runs perfectly !!!! ![]() Thank you very much !!! ![]() Have a nice day !!!! Viki. ![]() |
Автор: viktorijakup 16.9.2008, 16:34 |
Hi !!! I have problem... ![]() When my file name with "interval", for example: PLB2 5284.tex, script doesn't work. ![]() |
Автор: sir_nuf_nuf 16.9.2008, 21:49 | ||||
viktorijakup, let me guess... you call script in this manner:
No wonder, script will try to copy 3 files.. try this:
am i right ? ![]() |
Автор: viktorijakup 18.9.2008, 11:06 | ||
Hi sir_nuf_nuf !!! Your script work perfectly and with file name with "interval", but when I run script from "Main meniu" I get mistake. You could it view in picture: ![]() This script I include in *.bat place.
|
Автор: sir_nuf_nuf 18.9.2008, 15:27 |
It's not a problem of script. It's a problem of FAR. |