- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "find" problem: multiple use of result in -exec cl...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 04:55 AM
03-27-2007 04:55 AM
I tried several variations but find myself stumped... Maybe it's impossible but I'd like to know why.
I'm trying to create an ftp command file by using the following find statement:
find . -type f -newer start_file_name -exec echo put {} `basename {}` >> ftp_commands \;
I want to use "basename" because the directory structure doesn't exist on the target server.
A test of the above produces the following:
put ./work/pts8531/tsk/test_all_sql.sh ./work/pts8531/tsk/test_all_sql.sh
put ./work/pts8531/ctk/test_all_sql.sh ./work/pts8531/ctk/test_all_sql.sh
put ./test ./test
put ./nbcase/testcomp.sql ./nbcase/testcomp.sql
put ./ora600/test_query.sql ./ora600/test_query.sql
put ./ora600/test_query.log ./ora600/test_query.log
put ./sysmon/test ./sysmon/test
Any ideas?
RayB
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 05:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 05:11 AM
03-27-2007 05:11 AM
Re: "find" problem: multiple use of result in -exec clause
#!/usr/bin/sh
typeset OUT=ftp_commands
rm -f ${OUT}
typeset F=""
find . -type f -newer start_file_name -print | while read F
do
echo "put ${F} $(basename ${F})" >> ${OUT}
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 05:13 AM
03-27-2007 05:13 AM
Re: "find" problem: multiple use of result in -exec clause
Use 'xargs'.
# find . -type f -newer start_file_name | xargs -i echo put {} `basename {}` >> ftp_commands
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 05:33 AM
03-27-2007 05:33 AM
Re: "find" problem: multiple use of result in -exec clause
find . -type f -newer start_file_name -exec echo put {} \\c \; -exec basename {} \; > ftp_commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 06:43 AM
03-27-2007 06:43 AM
Re: "find" problem: multiple use of result in -exec clause
3 perfect answers.
Sorry James, close but no cigar.
Looks like the result can only be used once by "-exec" clause or used outside the execution of the find command.
Shows I have a lot to learn...
Thanks all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 06:45 AM
03-27-2007 06:45 AM
Re: "find" problem: multiple use of result in -exec clause
thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 04:47 PM
03-27-2007 04:47 PM
Re: "find" problem: multiple use of result in -exec clause
You might be able to use $(...) and then quote the $ then use the sh and eval but Clay's solution would be easier to understand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 06:23 AM
03-28-2007 06:23 AM
Re: "find" problem: multiple use of result in -exec clause
for f in $(find...) ; do
echo $f $(basename $f) >> file
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 06:25 AM
03-28-2007 06:25 AM