472,990 Members | 3,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,990 software developers and data experts.

File name with "interval"

viktorijakup
Hi !!!

Expand|Select|Wrap|Line Numbers
  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!/usr/bin/perl
  14. use warnings;
  15. use strict;
  16. use File::Path;
  17. use Cwd;
  18. use File::Copy;
  19. use File::Spec::Functions;
  20. #hardcoded 
  21. my $FP = 'D:\conv';
  22. my $TP = 'X:\sgml_db';
  23. my $NAME = 'MMC1';
  24. my ($from_file, $to_file) = ($ARGV[0], $ARGV[0]);
  25. my $cwd = `cd`;
  26. chomp $cwd;
  27. my ($from_dir, $to_dir) = ($cwd, $cwd);
  28. #rename file part
  29. $to_file =~ s/.*\.(.+)/$NAME.$1/;
  30. #rename dir part
  31. $to_dir =~ s/^\Q$FP\E/$TP/;
  32. mkpath($to_dir);
  33. copy(catfile($from_dir, $from_file), catfile($to_dir, $to_file)) 
  34.     or die "can't copy file";
  35. exit 0;
  36.  
  37. __END__
  38. :endofperl
  39.  
This script work perfectly and with file name with "interval", for example: PLB2 5284.tex,
but when I run script from "Main meniu" I get mistake.

You could it view in picture:



Help me with this problem....!!!

I must have script....which send file with name with "interval" from "Main meniu".
Sep 18 '08 #1
4 1981
numberwhun
3,509 Expert Mod 2GB
I would change line 33 to be:

Expand|Select|Wrap|Line Numbers
  1. copy(catfile($from_dir, $from_file), catfile($to_dir, $to_file)) or die "can't copy file: $!";
  2.  
The "$!" will print out the error that was produced from the copy attempt. Your error lets you know something was wrong, but unless you print out the actual received error, you won't know the real issue.

Regards,

Jeff
Sep 18 '08 #2
Hi !!!

Now i get mistake:

Expand|Select|Wrap|Line Numbers
  1. can't copy file: No such file or directory at D:\MMC1.bat line 21.
  2.  
V.



I would change line 33 to be:

Expand|Select|Wrap|Line Numbers
  1. copy(catfile($from_dir, $from_file), catfile($to_dir, $to_file)) or die "can't copy file: $!";
  2.  
The "$!" will print out the error that was produced from the copy attempt. Your error lets you know something was wrong, but unless you print out the actual received error, you won't know the real issue.

Regards,

Jeff
Sep 19 '08 #3
numberwhun
3,509 Expert Mod 2GB
Hi !!!

Now i get mistake:

Expand|Select|Wrap|Line Numbers
  1. can't copy file: No such file or directory at D:\MMC1.bat line 21.
  2.  
V.

I would guess that one of the directories you are referencing in the code does not exist (or files).

Regards,

Jeff
Sep 19 '08 #4
Hi !!!

But when I call script in this manner:

Expand|Select|Wrap|Line Numbers
  1. script.bat ''file with spaces.txt''
My script work perfect...

V.



I would guess that one of the directories you are referencing in the code does not exist (or files).

Regards,

Jeff
Sep 19 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Thiru | last post by:
Hi, Greetings to All. I have encountered a problem while working on DB2 Governer. I build my configuration file as below.(Just for practise) desc "Restrict the Unit of Work to be less then 1...
3
by: UnixSlaxer | last post by:
Hello All, While doing some TPC benchmark testing on DB2-UDB 8.2, I face the following problem when running this query: select * from lineitem where l_shipdate <= date '1998-12-01' -...
0
by: Peter | last post by:
When I issue call sqlj.install_jar('file:///f:/jars/mail.jar','MAIL'); I get the messages SQL4301N Java or .NET interpreter startup or communication failed, reason
8
by: jchludzinski | last post by:
Is there a format specification for printf that will result in: 1000000 being printed as 1,000,000? Or 1000000.0 as 1,000,000.0? ---John
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
3
by: Crash_beta | last post by:
Let me show u what I have,, I need to make this work with comma's in the numbers like 123,000.45 Not just 123000.45 <script type="text/javascript"> <!-- Begin
4
by: jonceramic | last post by:
Hi guys, I have a user who wants to have a report that shows only the 10th value recorded by his equipment. (i.e. His equipment records temperature every 30 seconds, but he only wants to view...
7
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box...
10
by: CuTe_Engineer | last post by:
hii, i have cs assignment i tried to solve it but i still have many errors , plzz help mee :"< it`s not cheating becuz i`ve tried & wrote the prog. i just wanna you to show me my mistakes ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.