The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
find and move natasha80 UNIX for Advanced & Expert Users 7 11-04-2008 03:32 PM
edit results of a find command grep_whoami Shell Programming and Scripting 6 10-15-2007 06:16 PM
How to sort find results groundlevel UNIX for Dummies Questions & Answers 8 11-09-2005 02:36 AM
find results Carmen123 UNIX for Dummies Questions & Answers 5 08-10-2005 10:27 AM
find move saswerks Shell Programming and Scripting 4 02-24-2005 04:48 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-19-2007
pimentelgg pimentelgg is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
need to move find results

I am looking for files of a certian type and logging them. After they are logged they need to be moved to a different directory. HOw can i incorporate that in my current script?

CSV_OUTFILE="somefile.csv"
find . -name W\* -exec printf "%s,%s,OK" {} `date '+%Y%m%d%H%M%S'` \; > ${CSV_OUTFILE}

They would need to be moved from the current directory to one at the same level. For example:

From ./name/inbox/file
To ./name/archive/file
  #2 (permalink)  
Old 12-19-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Have you considered using "mv" ?
  #3 (permalink)  
Old 12-19-2007
pimentelgg pimentelgg is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
lol, yeah, let me clarify my question.

How can I apply the mv command to a list of find results?
  #4 (permalink)  
Old 12-19-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
How about giving us an example of what the CSV output would be....
  #5 (permalink)  
Old 12-20-2007
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,079
cp

Hi,

i am not quiet sure about your req.
Suppose it is very close to follow:
Hint: Find all the .txt file in current directory, record them in file.log file and then copy them to the parent directory.

Hope you can finish it according to your exact requirements.


code:
Code:
for i in `find . -name \*.txt`
do
	echo $i >> file.log
	cp $i ../	
done
  #6 (permalink)  
Old 12-20-2007
pimentelgg pimentelgg is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
I guess I'd better clarify a bit.

Here is my current script, it formats the output of the find command:

CSV_OUTFILE="somefile.csv"
find . -name W\* -exec printf "%s,%s,OK" {} `date '+%Y%m%d%H%M%S'` \; > ${CSV_OUTFILE}

Now, I need to modify this script to also use the output of the same find command as a list of files that need to be moved.

The CSV file does not need to be moved, later in the script I FTP it to another server where the results are parsed and each time this script is run, it is overwritten anyway.

Hope that explains it better.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0