473,386 Members | 1,795 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.

copy particular extension files recursively and store it in same folder structure ?

How do I copy particular extension files recursively and store it in same folder structure?

Expand|Select|Wrap|Line Numbers
  1.  
  2.     use strict;
  3.     use warnings;
  4.  
  5.     my $pwd         = "/home/ra/DEMO";
  6.     my $destination = "/home/ra/output";
  7.  
  8.     opendir(DIR, "$pwd") or die "Error";
  9.     my @files = readdir(DIR);
  10.     closedir(DIR);
  11.  
  12.     foreach my $file ( @files ) {
  13.         next if ($file !~ /\.config$/i);  # filtered only file with extension .config
  14.         system(`cp "$pwd $file" "$destination"`); 
  15.     }
  16.  
Feb 27 '17 #1
0 4251

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

Similar topics

1
by: Sue | last post by:
How can I count the number of files in a folder? Thanks for all help!! Sue
9
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3)...
17
by: b007uk | last post by:
Hi all, I really need your advice. I have to store over a million files, 10 - 15 kb each, in one folder. The files are created by my php script, sometimes the old files are deleted and new ones...
9
by: pamela fluente | last post by:
What is the most current (for framework 2.0) and easy way to copy recursively all files from folder "Folder1" to folder "Folder2" ? Is there any simple function in the framework to do that? ...
3
by: rhepsi | last post by:
Hii all, i have a source folder, i have many .jpg files .. Now i want all the .jpg files to be copied into new folder... can anyone plz help me.... How to copy all the files from 1...
1
by: kumarboston | last post by:
Hi all, I am trying to copy couple of directories and their files to another place. Each directory have 25-30 files and numbered accordingly, the problem I am facing is, I have to copy files...
5
by: IUnknown | last post by:
Ok, we are all aware of the situation where modifying the folder structure (adding files, folders, deleting files, etc) will result in ASP.NET triggering a recompilation/restart of the application....
0
by: gayatri pande | last post by:
Hi Can any one suggest a SVN command which recognizes the newly added and modified files and copy them. Thanks.
3
by: rajesh dogra | last post by:
Hi All, i am trying to move a bunch of files in a newly created directory: here is what i am trying to do. : i read my source dir. : i search for a file which has the folder name information...
1
by: optimusprime | last post by:
Hi All, I have been surfing to get some idea on how to compare same files from two different paths. one path will have oldfiles directory and another path will have newfiles directory. Each...
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: 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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.