473,386 Members | 1,710 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,386 software developers and data experts.

copying multiple files

hello all,

How can i copy files with a particular extension.

For eg:
I am using

copy ("$HOME_DIR/file1.txt" ,"$LOCAL_DIR/") or warn "Cannot copy file:
$!";

to copy a file, but if i have to copy all the files with the extension
*.txt how do i do it...

Thanx in advance
Jul 19 '05 #1
1 12141
In article <36**************************@posting.google.com >, yaduraj
<ya******@yahoo.com> wrote:
hello all,

How can i copy files with a particular extension.

For eg:
I am using

copy ("$HOME_DIR/file1.txt" ,"$LOCAL_DIR/") or warn "Cannot copy file:
$!";

to copy a file, but if i have to copy all the files with the extension
*.txt how do i do it...


Perl doesn't have a built-in copy function, so you must be using
File::Copy, If you were to post a complete, minimal program that
demonstrates your problem, people trying to help you wouldn't have to
guess about the details.

To apply a function to different files, check out the glob function or
the File::Find module. You probably want to wrap your copy command in a
loop of some sort, because perl doesn't know whether you want to copy
the each file to a file of the same name in a different directory, or
to a different name in the same directory, or copy all of the files to
a single, concatenated file. You will have to tell it.

FYI: this newsgroup is defunct; try comp.lang.perl.misc in the future.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
4
by: Alex Vinokur | last post by:
Copying files : input to output =============================== C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer...
0
by: Dan | last post by:
We debug a VB.Net App that uses compact framework to a DAP Windows CE.Net device. When I debug I would like to only have the EXE copied down. Right now it copies any referrences as well and...
8
by: John Smith | last post by:
Hi folks, I know how to place text into the user's clipboard: Clipboard.SetDataObject("My Copied Text"); but how do I place a file in there? So, if I have a file C:\test.txt, how can I place...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
17
by: Kerr | last post by:
Hi all, I am sure that this is quite simple but can't find any good examples anywhere. I need a method of copying multiple files from a source directory to a destination directory. The file...
6
by: Jim Heavey | last post by:
I have written a little application which copies files from one location to another location. Before it copies the file, it ensure the directory for both the from and to locations is valid. It...
2
by: Edhy Rijo [Progytech] | last post by:
Hi All, I am learning VB.NET and building small application that will do the following: 1.. Copy all files from a DVD to a specific folder in the hard drive and overwrite all files always. The...
6
by: kimiraikkonen | last post by:
Hi, I use system.io.file class to copy files but i have a difficulty about implementing a basic / XP-like progress bar indicator during copying process. My code is this with no progress bar,...
1
by: skygremlin | last post by:
I am trying to write a simple VB app to copy all directories and files off a thumb drive to a directory on a pc. I have a couple things I am trying to automate. Final Build will: - Have...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.