473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Script to copy files from one folder to another

2
Hi, I'm looking for a script to copy transaction log backup files from a network drive I have mapped to a local folder. Part of the filenames are common

dbname_tlog_datehour.trn (date is formated y/m/d and is 24 hour format ex: 1600, 1700, 1800....)

I've searched some perl forums and found a few scripts to try but haven't had any luck getting this working. Any help is appreciated.
Feb 4 '09 #1
3 35353
eWish
971 Expert 512MB
We don't have any scripts. Do you know perl? Have to tried to write the code yourself? Are you having problems with your code?

--Kevin
Feb 4 '09 #2
AngeB
2
Thanks for the reply Kevin. I know very little perl. I forgot to post the code that I was trying to get working. I managed to figure to figure it out. I'll make sure to post the code and error next time.

Ange
Feb 11 '09 #3
Icecrack
174 Expert 100+
Here is one i made and use.

Expand|Select|Wrap|Line Numbers
  1. use File::Copy;
  2.  
  3. $dir="\\\\Server\\logs\\"; # make sure you add the backslashes on the last directory
  4. opendir(DIR, $dir) or die "can't opendir $dir: $! \n";
  5.  
  6. @files=readdir(DIR);
  7. closedir DIR;
  8.  
  9. foreach $file (@files) {
  10.   if (-f "$dir$file") {  
  11.  
  12. $moveloc="C:\\backup\\logs\\$file"; # Make sure the directory is already made.
  13. $old = "$dir$file";
  14. $new = "$moveloc";
  15. copy($old, $new) or die "Copy Faild: $!";
Feb 12 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Antonio Lopez Arredondo | last post by:
hi all !!! I need to copy a folder and its subfolders to another location; which class should I use ? could only find the System.IO.Directory.MOVE but don't know how to COPY. thanks in...
11
by: Mike | last post by:
I want to be able to copy a directory of files (all .HTM files) from a network drive to a local drive on the machine c:\HTMFiles , How can i do that? I tried File.Copy(source, dest) but i need...
8
by: Chris Strobel | last post by:
I have 2 web servers where I need to write a PDF file and need to keep them in sync. In others words, If the Server1 is getting called to create the PDF, then it needs to copy the PDF to the other...
5
by: Roy | last post by:
My dll file is copied to the "%windir%\Microsoft.NET\Framework\{version}Temporary ASP.NET Files" folder when I compile my asp.net project. When I run the application. The dll under this folder is...
2
by: Xavier Valdés | last post by:
Hi all, I would like to copy FILES from the clipboard to a desired folder from VB.NET. I was able to copy files (with filedrop data format) to the clipboard but I don't know how to catch this...
2
by: Dámaso Velázquez Álvarez | last post by:
Hi, I need to copy files to a shared folder protected by username/password. I don't now autenticate me in the server to copy the files. Do I need to use the credentials to do it? How can i do...
4
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new...
1
by: dkmarni | last post by:
Hi, I am trying to do this perl script, but not able to complete it successfully. Here is the description what the script has to do.. Accept two and only two command line arguments. Again,...
0
by: studentintau | last post by:
I would thank you if you help me with the next subject : how do i copy all files from temporary internet files folder to another folder in drive D?
2
by: parmarjm | last post by:
Hi I am trying to copy files from mapped drive (J:\) to a different machine. The perl script is going to run on my machine to copy files from one place to another. File transfer works when i copy...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.