LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-05-2008, 03:22 AM   #1
Ashiro
LQ Newbie
 
Registered: Mar 2005
Posts: 3

Rep: Reputation: 0
Question Copying single file to multiple locations


I've hunted all over for this but only find similar yet unworkable solutions.

I have a file: favicon.ico that I want to copy into the location of all the other favicon.ico files in the /var/www directory tree.

There's over 150 sites in there so I want to do this without resorting to manually copying to each one.

I thought I could do a find then exec but hat doesn't seem to work.

Any ideas?
 
Old 12-05-2008, 03:59 AM   #2
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
This works for me:

Code:
find /var/www -name favicon.ico -exec cp /path/to/favicon.ico \{\} \;
 
Old 12-05-2008, 04:22 AM   #3
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
What's the meaning of \{\} as opposed to {}?

Just out of interest.
 
Old 12-05-2008, 05:13 AM   #4
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
I think I had problems with some shell that 'interpreted' the '{'. I might be wrong though, don't remember exactly .

@Ashiro: this means that it might work as:
Code:
find /var/www -name favicon.ico -exec cp /path/to/favicon.ico {} \;
 
Old 12-05-2008, 05:50 AM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I haven't tried anything on this, but it occurred to me that you may need to add "-f" to "cp", since you want to force replacement.

vladmihaisima, thanks for the clarification.
 
  


Reply

Tags
bash, copy, cp, exec, files, find, scripting


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is multiple owners of a single file possible? can user1 own a file that root also own dave247 Debian 3 10-09-2008 04:53 AM
Copy single file to multiple locations - What am I doing wrong decartes Linux - Newbie 7 04-26-2008 04:09 PM
Copying a single file to multiple directories quest49 Linux - Software 6 12-04-2006 08:07 AM
Adding Multiple Files In A Single Gz File onacorpuscle Linux - Newbie 3 08-31-2006 03:18 AM
Copying a single file to multiple directories tgolly Linux - Newbie 3 04-26-2004 03:47 PM


All times are GMT -5. The time now is 04:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration