Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Perl (http://www.programmingforums.org/forum21.html)
-   -   Setting location for a temp file (http://www.programmingforums.org/showthread.php?t=14152)

Ade Oct 10th, 2007 12:22 PM

Setting location for a temp file
 
Hi,

I have got a script to create a temp file using:

:

($fh, $filename) = tempfile(SUFFIX => '.vcf');

Now you can set the location directory of this file using:

:

$dir = tempdir( CLEANUP => 1 );
($fh, $filename) = tempfile( $template, DIR => $dir);


But that puts the temp file in a directory in the /tmp directory. Something like:

:

/tmp/Ir9usvCuAr/GykBOCKgOc

My question is how can I set a directory to hold these new temp files somewhere else in the file structure? Somewhere like /home/me/public_html/thisplace_here/



Thanks for any advice :)

Ade Oct 10th, 2007 12:29 PM

Should have said that just putting the path in $dir just gives an error.

:D

DaWei Oct 10th, 2007 11:06 PM

Perhaps you have spaces in the path? Are you escaping backslashes, if you're using backslashes? (You don't mention your system.)


All times are GMT -5. The time now is 9:12 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC