Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving files to different directories?

Status
Not open for further replies.

davef101

MIS
Mar 3, 2006
34
GB
what code would move a .txt file from one directory to another directory on my server ?
 
Code:
use File::Copy;

move ("/home/directory/one/file.txt", "/home/somewhere/else/file.txt");

-------------
Kirsle.net | Kirsle's Programs and Projects
 
or just use perls rename() function:

Code:
rename("/home/directory/one/file.txt","/home/somewhere/else/file.txt");

File::Copy is a bit more flexible though if rename() doesn't work for some reason.

- Kevin, perl coder unexceptional!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top