Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: moving files from folder1 to folder2

by haoess (Curate)
on May 14, 2004 at 22:41 UTC ( [id://353514]=note: print w/replies, xml ) Need Help??


in reply to moving files from folder1 to folder2

Sorry, I don't see any way to rename files via CGI. Do you mean perl? Then you should have a look at the mentioned rename function. rename has some limits. Maybe File::NCopy can help you.

-- Frank

Replies are listed 'Best First'.
Re: Re: moving files from folder1 to folder2
by Anonymous Monk on May 14, 2004 at 23:04 UTC
    Why are you two talking about renaming the file? Am I not understanding what I'm asking? Is that what you'd need to do in order to transfer the file from one directory into another?

    Would this be what I need?

    use File::NCopy; # the below are the default config values $file = File::NCopy->new( 'recursive' => 0, 'preserve' => 0, 'follow_links' => 0, 'force_write' => 0, 'set_permission' => \&File::NCopy::u_chmod, 'file_check' => \&File::NCopy::f_check, 'set_times' => \&File::NCopy::s_times, ); $file = File::NCopy->new(recursive => 1); $file->copy "/home/fred/public_html/temp/image.gif","/home/fred/pu +blic_html/final/image.gif";
      Why are you two talking about renaming the file? Am I not understanding what I'm asking? Is that what you'd need to do in order to transfer the file from one directory into another?
      Oh, come on, show some initiative. Read the manual page, and learn what rename is about, and then try it out.

      Abigail

      What is your difference between moving and renaming? In UNIX language, you can rename a file if source and destination are in the same filesystem (aka partition). That's very fast, because only inode information is changed. If they are not: You copy the source file to destination and unlink the source file. That's the way it goes.

      If you use perl's rename, you should take care about this. That's why I pointed you to the CPAN module. It takes this care for you and does the same as mv(1) does (if renaming is not possible): Read the source file and write it to its destination.

      -- Frank

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://353514]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-03-29 00:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found