Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > script to find the current directory

Reply
Thread Tools

script to find the current directory

 
 
Kannan Ekanath
Guest
Posts: n/a
 
      01-30-2004
Hi,
stuck up with this real sitter. can someone tell me how to find the full
path of the current directory inside a pearl script (because the script
can be called from different directories i just wanted to know the full
path of the directory i.e, the caller).

saw things like
my @filelist = global("*");
to get the file list...is there any way to get the current directory
Right now i am using the alternative of pwd >> somefile and picking it
up from there

Thanks
Kannan

 
Reply With Quote
 
 
 
 
Todd de Gruyl
Guest
Posts: n/a
 
      01-30-2004
Kannan Ekanath wrote:

> can someone tell me how to find the full path of the current directory


Here are two ways:

use Cwd; # more portable
my $dir = cwd;

or

my $dir = `pwd`; # assuming unix-like os here
chomp $dir;

--
Todd de Gruyl
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      01-30-2004
Kannan Ekanath wrote:
> stuck up with this real sitter. can someone tell me how to find the
> full path of the current directory [...]


perldoc Cwd

jue


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the directory of the current script? laredotornado Ruby 5 01-02-2010 06:45 PM
Apache vs IIS current directory fro Perl script andipfaff Perl Misc 6 05-13-2008 06:49 AM
insert python script in current script Prashant Python 2 04-18-2008 07:16 PM
How to fetch output of some other script in the current running perl script? ritugoyal12@gmail.com Perl Misc 4 10-27-2007 03:52 PM
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57