On 2011-12-13, gialloporpora <gialloporp...@gmail.com> wrote:
> Dear all,
> I would like to create a little script to rename my files, I think to 
> use argparse module to create it.
> I would like to know how to obtain the path where script is executed and 
> the path where the file script is stored.
>
> For example, if I save my script in c:\python27 and I put the
> directory in %path% I can execute it from any folder, I would
> like to get the two directory path.

Current working directory is available with os.getcwd()

The location of the script you are running may be available as
os.path.basename(sys.argv[0]).

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to