Sponsored Content
Top Forums Shell Programming and Scripting Find all text files in folder and then copy to a new folder Post 302326824 by cgkmal on Friday 19th of June 2009 02:26:19 AM
Old 06-19-2009
Find all text files in folder and then copy to a new folder

Hi all,

*I use Uwin and Cygwin emulator.

I´m trying to search for all text files in the current folder (C/Files) and its sub folders using

Code:
find  -depth -name "*.txt"

The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with

Code:
find  -depth -name "*.txt" -type d -exec cp {} Text \;

But this command it´s not working even when replace Text with C/Files/Text.

Please somebody could give an advice about this.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to copy hidden files from one folder to another

dear all, i want to copy all files in my home dir to another. from my home dir i have given ls -la then some hidden files are there with dot . .. and i also want to copy all dirs in my home as it is . because iam upgrading the system how to copy all files and dirs in my home dir... (1 Reply)
Discussion started by: rajan_ka1
1 Replies

2. Shell Programming and Scripting

How to copy one folder to another with existing files

For example, /tmp/folder1 includes /tmp/folder1/a /tmp/folder1/b /tmp/folder2 includes /tmp/c Is there a command without removing files in /tmp/folder2 first to copy the /tmp/folder1 to /tmp/folder2? and the result should be /tmp/folder2 will include only /tmp/folder2/a... (2 Replies)
Discussion started by: lalelle
2 Replies

3. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

4. Shell Programming and Scripting

Copy all zipped files from one folder to another

Hi everyone, when I try to copy *.gz files run cp within the correct source folder it works as follow: Source folder = C:/Documents and Settings/user/Recent papers/2771/ Destination folder = C:/Documents and Settings/user/My documents/1532/temp cp *.gz "C:/Documents and Settings/user/My... (2 Replies)
Discussion started by: cgkmal
2 Replies

5. Shell Programming and Scripting

Find files of type within folder copy multiple results to different folders

Ok question number two: I'd like to search a directory for multiple file types (rar, txt, deb) and depending on what's found, copy those files to folders named Rar, TextFiles, and Debs. I'm looking for speed here so the faster the script the better. I want it to be a function that I pass 1 argument... (4 Replies)
Discussion started by: DC Slick
4 Replies

6. Shell Programming and Scripting

Loop through text file > Copy Folder > Edit XML files in bulk?

I have a text file which contains lines in this format - it contains 105 lines in total, but I'm just putting 4 here to keep it short: 58571,east_ppl_ppla_por 58788,east_pcy_hd_por 58704,east_pcy_ga_por 58697,east_pcy_pcybs_por It's called id_key.txt I have a sample folder called... (9 Replies)
Discussion started by: biscuitcreek
9 Replies

7. UNIX for Dummies Questions & Answers

How to copy files to one folder?

Hi , I have a file like this, i need to trace its path and copy the files from its path to one folder. I need to replace elib.com,melib.com to F:\.Here i need to copy to a folder called image. Please help http://elib.com/SHC/NLNLHB/020001498.pdf ... (4 Replies)
Discussion started by: umapearl
4 Replies

8. Shell Programming and Scripting

copy folder and its contents to another folder

Hi experts, I am coming to you with this basic question on copying a folder and its content from one location to another folder using PERL script. This is my requirement. I have a folder AB under /users/myhome I want to copy AB and its contents to /user/workspace. Finally it should... (1 Reply)
Discussion started by: amvarma77
1 Replies

9. UNIX for Dummies Questions & Answers

Copy files to folder.

Hi, I have a folder which contains some files like this. bin.000001 bin.000002 bin.000003 bin.000004 bin.000005 bin.000129 bin.index I want to copy all these files to a new folder except the last files. Please provide some ideas. Please use next time code tags for your code... (6 Replies)
Discussion started by: arijitsaha
6 Replies

10. Shell Programming and Scripting

How to copy files with the same filenames as those in another folder to that same folder?

Hello All A similar question like this was asked before but I need to change part of the question. I've two folders, Folder A contains some image files in 150 subfolders; Folder B contains text files in 350 subfolders. All image files in Folder A have the same filename as the text... (5 Replies)
Discussion started by: chlade
5 Replies
Text::WordDiff::ANSIColor(3pm)				User Contributed Perl Documentation			    Text::WordDiff::ANSIColor(3pm)

Name
       Text::WordDiff::ANSIColor - ANSI colored formatting for Text::WordDiff

Synopsis
	   use Text::WordDiff;

	   my $diff = word_diff 'file1.txt', 'file2.txt';
	   my $diff = word_diff $string1,   $string2,   { STYLE => 'ANSIColor' };
	   my $diff = word_diff *FH1,	     *FH2;	  \%options;
	   my $diff = word_diff &reader1,   &reader2;
	   my $diff = word_diff @records1,  @records2;

	   # May also mix input types:
	   my $diff = word_diff @records1,  'file_B.txt';

Description
       This class subclasses Text::WordDiff::Base to provide a formatting class for Text::WordDiff that uses ANSI-standard terminal escape
       sequences to highlight deleted and inserted text. This formatting class is the default class used by Text::WordDiff; see its documentation
       for details on its interface. This class should never be used directly.

       Text::WordDiff::ANSIColor formats word diffs for viewing in an ANSI-standard terminal session. The diff content is highlighted as follows:

       Deletes
	   Deleted words will display in bold-faced red. The ANSI standard for strikethrough is also used, but since it is not supported by most
	   terminals, likely will not show up.

       Inserts
	   Inserted words will display in bold-faced, underlined green.

       All other content is simply returned.

See Also
       Text::WordDiff
       Text::WordDiff::HTML

Support
       This module is stored in an open repository at the following address:

       <https://svn.kineticode.com/Text-WordDiff/trunk/>

       Patches against Text::WordDiff are welcome. Please send bug reports to <bug-text-worddiff@rt.cpan.org>.

Author
       David Wheeler <david@kineticode.com>

Copyright and License
       Copyright (c) 2005-2008 David Wheeler. Some Rights Reserved.

       This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

perl v5.10.0							    2009-09-24					    Text::WordDiff::ANSIColor(3pm)
All times are GMT -4. The time now is 06:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy