LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-24-2003, 01:43 AM   #1
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
How would you cp a file to multi subdirs?


This was my solution:
-----------------------------------------
#!/usr/bin/perl

@dirh=`ls -d */`;


foreach $oneof (@dirh){

system("cp -f @ARGV[0] $oneof");


}
-------------------------------------------

but there just has to be a better way
 
Old 02-26-2003, 07:41 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
In bash:

for d in `ls -d */`; do cp -f filename $d; done
 
Old 03-04-2003, 12:41 AM   #3
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Original Poster
Rep: Reputation: 31
Thanks
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
samba file share in multi coding chungchungip Linux - Software 4 09-13-2005 09:43 AM
Help! Multi-file optimizations? sllawler Linux - Software 2 06-24-2005 11:45 AM
Multi-volume file archives JoshSmith41 Linux - Software 3 07-05-2004 06:42 PM
Multi-file search and replace? miknight Linux - General 4 10-21-2003 06:45 PM
MS Access DB File multi User problem with SAMBA hellertech Linux - Networking 0 07-14-2003 05:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:34 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration