copying 1 file to many directories
The current directory contains:
"source_001" and "source_002" and "source_003" ... The total number of these source directories is unknown, it changes every week. |
Code:
for i in source_??? |
Could it be done with links instead?
|
Quote:
Here is a short description of "links". Every file system uses some variation of the following. A file exists as a series of bytes on the disk, often called an "extent". A structure called an "inode" keeps track of where the data lives on disk. A folder or directory is just another data file that happens to contain "filenames", some other details, and details about the data extent. In most cases, there is a one-to-one relationship between what appears in the directory and the data file. Like an entry in a library card index, a "link" makes an entry in some directory for data that lives on the disk somewhere else just like one library book might have dozens of index cards. A given set of data might have a large number of these index-card-like duplicate entries. There is no reason for these links to have identical names, but you need to keep track of them. A major advantage is that you have one copy of the data regardless of how many directories are used to name it and which users own those directories and link entries. A major disadvantage of links is that you must remember to clean-up all of them when you delete the associated data file. (I vaguely remember that the fsck family of commands will notice and report and help deal with this issue. I welcome comments from someone who knows.) One example of link use is the System-V style system initialization. The system startup scripts get stored in /etc/init.d -- for example, apm, named, networking, samba, gdm, and so on. Then each of the runlevel folders holds a link, for example /etc/rc5.d/S15networking, that then points to the actual script. One copy of the script content. Edit one -- edit them all. Link to that content each place that you want to use it. ~~~ 0;-Dan |
Moved to Linux--Newbie
|
All times are GMT -5. The time now is 03:33 PM. |