CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
rename file after script finishes


New User

Jan 28, 2013, 5:17 AM

Post #1 of 2 (736 views)
rename file after script finishes Can't Post

Hey guys,

I'm a little stuck here. I have a perl script that is working on couple of files and saving them to a directory and right now it's something like this:

gzcat my_file1.gz | > tmp_output_file1.txt

So the question is quite simple but I can't figure out how to do it in the perl file. I need to, when the script has finished working one 1 file, to rename just that 1 files. Please note that the same script is working on couple of files at a time, so in same directory there might be a file with name tmp_output_file2.txt for example that is not finished and it shouldn't be renamed.


Veteran / Moderator

Jan 29, 2013, 5:51 AM

Post #2 of 2 (730 views)
Re: [sg3] rename file after script finishes [In reply to] Can't Post

Just try this:

rename $old_name, $new_name;

If you wrote to the file, make sure your file is closed before doing this.

(This post was edited by Laurent_R on Jan 29, 2013, 5:52 AM)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives