473,606 Members | 2,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 4307

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

Similar topics

1
13430
by: Sue | last post by:
How can I count the number of files in a folder? Thanks for all help!! Sue
9
8316
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) and two folders (Subfolder 1, Subfolder 2). .......I need to delete File1, File2, File3. Subfolder 1 contains FileA. .......Need to delete FileA. Subfolder 2 contains FileB, FileC, FileD.
17
2569
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 are written. So, basically on every connection my script reads/deletes/ writes files from/to that folder. Right now i have only around 300 000 files in that folder, and it feels like its getting slower for that script to work. It does work at the...
9
5711
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? -P
3
1221
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 folder to other folder with renaming the file names that are present in the source folder....??????
1
5663
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 numbered from 4-22 only and leave rest all. I have written a code but its only copying one directory and its files and not others. Overall /test1/step_1/prodinit_1....30 and I want to copy to /test2/step_1/prodinit_4...22 #!/bin/csh -f set dir1 =...
5
2625
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. In a nutshell, I understand how this can be considered desireable by some, but I am not one of those people. My situation is that we have a root site (hosted @ http://www.mydomain.com) in the root application folder '/'.
0
1349
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
2565
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 in it. This file is in the source folder. : i create that folder. : copy all the files from source dir in the new folder. Now every thing goes fine except for the last piece which is copy. when i check the folder after running the script i get...
1
4821
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 main directories will have sub-directories in them and each sub-directories inturn will have *.txt files(simple plain text file having several lines in them). Note : one advantage is that :
0
8009
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7939
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8432
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8428
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6753
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3919
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2442
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1285
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.