![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto copy for files from folder to folder upon instant writing | Bashar | UNIX for Advanced & Expert Users | 2 | 08-21-2008 02:44 PM |
| Moving Files from one folder to another folder | farooqpervaiz | Shell Programming and Scripting | 10 | 08-07-2008 02:20 AM |
| Finding Hidden files and protecting the folder containing hidden files from deletion | pochaw | Shell Programming and Scripting | 4 | 12-22-2007 01:33 AM |
| read files from folder and then call another script | girishnn | UNIX and Linux Applications | 1 | 11-08-2007 09:52 PM |
| read files from folder and then call another script | girishnn | Shell Programming and Scripting | 3 | 11-06-2007 06:53 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
script for Finding files in a folder and copying to another folder
Hi all,
I have a folder '/samplefolder' in which i have some files like data0.txt, data1.txt and data2.txt. I have to search the folder for existence of the file data0.txt first and if found have to copy it to some other file; next i have to search the folder for existence of file data1.txt and if found have to copy it to some other file. This has to continue for any number of files (like till data1000.txt). Please provide some shell script to do the same. Thanks, |
|
||||
|
My exact requirement is...
Step1: Find if data*.txt files exist in some/path Step2: If exists, copy the first such file (ex: data0.txt) to other/path Step3: remove the data0.txt Step4: Repeat step1 Hope this makes things more clear. Sorry, if i was not very clear in the beginning. ![]() |
|
||||
|
Then you could just use 'mv' instead of 'cp':
find /some/path -iname "data*.txt" -exec mv \"{}\" /other/path \; |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|