Hello,
I'm having a tough time using chdir in different versions of perl in a dos window (XP). In early versions of Perl 5.x it works just fine. I have a bat file that dynamically sets my perl path to either 5.0.x or to 5.8.8: -
path %path%;c:\perl\[whichever]
-
Then in I call the perl script which just has this: -
$dirLocation ='c:\[whatever]';
-
-
chdir $dirLocation or die "Can't cd to $dirLocation: $!\n";
-
-
In the earlier version of perl it works fine and moves dos to that directory. In 5.8.8 it doesn't. But nor does it die. It just doesn't switch directories. I've confirmed that it's at least looking for a valid dir by changing $dirLocation to something nonexistent and it does indeed then balk. So what am I missing here???
Thanks for any help.
John
6 9425
Hello,
I'm having a tough time using chdir in different versions of perl in a dos window (XP). In early versions of Perl 5.x it works just fine. I have a bat file that dynamically sets my perl path to either 5.0.x or to 5.8.8: -
path %path%;c:\perl\[whichever]
-
Then in I call the perl script which just has this: -
$dirLocation ='c:\[whatever]';
-
-
chdir $dirLocation or die "Can't cd to $dirLocation: $!\n";
-
-
In the earlier version of perl it works fine and moves dos to that directory. In 5.8.8 it doesn't. But nor does it die. It just doesn't switch directories. I've confirmed that it's at least looking for a valid dir by changing $dirLocation to something nonexistent and it does indeed then balk. So what am I missing here???
Thanks for any help.
John
If I may ask, how do you know that it is not working, especially if you get no errors?
Regards,
Jeff
Hi,
Try:
chdir("$dirlocation");
, Mike
Hi,
Try:
chdir("$dirlocation");
, Mike
adding quotes around a single scalar will not help and should really never be done anyway. It's a bad habit to get into when writing perl programs.
If I may ask, how do you know that it is not working, especially if you get no errors?
Regards,
Jeff
Jeff, DOS should change to the directory specified in the perl command. In my case it doesn't. It just stays where it was before running the script. Thanks.
Jeff, DOS should change to the directory specified in the perl command. In my case it doesn't. It just stays where it was before running the script. Thanks.
I would definitely go with eggi's suggestion of using the chdir() function to change the working directory and see if that works then.
Regards,
Jeff
Try using a forward slashes instead of a backward slashes
in your path.
Regards,
Sakurakun
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nicholas Geraldi |
last post by:
I have a script that uses the chdir() function. I know the script works (
works perfectly on my host ), but when I put the script on my server here at
work I get the following error.
Warning:...
|
by: Premshree Pillai |
last post by:
Hello,
I recently wrote a Perl version of pyAlbum.py -- a
Python script to create an image album from a given
directory -- plAlbum.pl .
It made me realize how easy-to-use Python is.
...
|
by: lonelyplanet999 |
last post by:
Hi,
I'm a newbie to perl and is now studying about perl programming, I
read some perl programming tutorials online (enter 'Perl tutorial' at
google.com) and also find some sample perl scripts...
|
by: Hendry Taylor |
last post by:
I wrote a perl script and tested it on windows and it works fine. I then
moved it onto a solaris machine and now it says that there is a syntax
error with the following line of code:
$user1 =...
|
by: dannycolligan |
last post by:
I have a strange problem with os.chdir... here is my script that I am
using to edit the filenames of my music library:
#!/usr/bin/python
from os import *
...
|
by: Ignoramus6539 |
last post by:
There were some strange requests to my server asking for config.php
file (which I do not have in the requested location).
I did some investigation. Seems to be a virus written in perl,...
|
by: Julien Biezemans |
last post by:
Hi everyone,
I've written a file:// scheme stream wrapper that acts like chroot()
(but is more flexible, does not require root privileges and works on any
platform). Everything works just fine...
|
by: georgewa |
last post by:
Greetings all, great forum, this is my first post.
Recently trying to write a script that is designed to move files based on timestamps. I am fairly new to Perl, so please bare with me. I have...
|
by: ashootoshverma |
last post by:
Hi Everyone,
I am new in perl programming can anyone help me to give a right way to do in this program
"Zip all .* file from a one windows directory to another directory."
Here is my code.
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |