05-27-2011
Unlink and copy actual file
Hello,
I have a set of directories, which has inside them, symbolic links to some files. What i would like to do is to covert the links into actual files, i.e. remove the link and copy the actual file here...
I tried to see unlink command but i think all it does is delete the link, is there anything that would transform the link to the actual copy ?
Thanks in advance
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi all
I did something incorrectly about link command.
I try to make a link from a sub-dir to root dir, but I use the following command:
link / zzz
the result is sub-dir "zzz" was linked to "/"
Then I want to remove the "zzz" by using unlink command:
unlink zzz
It say that "Device... (1 Reply)
Discussion started by: umonk
1 Replies
2. UNIX for Dummies Questions & Answers
Hello all,
I have a script which runs every 15 minutes and moves all but latest 10 files from a directory (A) to Directory (B).
Most of the times this job runs fine but sometimes it is giving "mv: cannot unlink {Target Directory name } : Permissions denied."
Any help about this error msg... (1 Reply)
Discussion started by: super_duper_guy
1 Replies
3. Shell Programming and Scripting
Hi,
I have a two lines of code both intend to perform the same task.
unlink $CtrFile;
system ("rm $CtrFile");
Both of which try to delete a certain file. However when I use the unlink command the file does not get deleted. When I use the "rm" system... (2 Replies)
Discussion started by: jerardfjay
2 Replies
4. UNIX for Dummies Questions & Answers
Hi all,
I have a file entries.txt that contains a number of entries all on seperate lines e.g.
test1
test2
test3
test4
Then in a directory called /TestFiles I have a number of files that could contain the above text in the file name
e.g. qwertytest1.csv qwertytest2.csv... (2 Replies)
Discussion started by: not4google
2 Replies
5. Shell Programming and Scripting
Hi,
i have a sql file named sample.sql. The query is given below.
select count(*) from $TABLE_NAME
In the main script, i am sourcing this sql. I need to replace the $TABLE_NAME with actual value, before running the query. How can i achieve that?
The logic i tried is given below:... (3 Replies)
Discussion started by: bharathappriyan
3 Replies
6. Solaris
Using lsof command I was able to query all Regular Files opened for write.
A specific processID related output shows some FileDescriptors(FD 45 in second output 45w) pointing to real file. But most of the FDs(1, 2, 5 in first output and 31,29,10 in second output) are pointing to root of the disk... (19 Replies)
Discussion started by: kchinnam
19 Replies
7. Shell Programming and Scripting
Here is my script which gives the below output when I run.First it will display the list of all groups and then ask for enter the group name and after it will ask for contribuotors or users then I will add contribuotirs or users and it will show the list of all users associated with that group but... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies
8. Shell Programming and Scripting
I am very noobish to UNIX, our guy is on vacation so I am trying to take up some slack while he is away.
Typically when we use sql from within a shell script, we do so from a file containing the sql.
Example:
$ORACLE_HOME/bin/sqlplus $ORA_DBCU/$ORA_DBCP @${cron_dir}/${report_file}.sql
... (10 Replies)
Discussion started by: biobill
10 Replies
9. Shell Programming and Scripting
I wish to unlink multiple links, but man pages shows
unlink - call the unlink function to remove the specified file
let's linked are in number sequence and I'm doing
unlink `echo {1..500}`
This fails..
Is their any other command to execute it or I need to call the unlink function that... (1 Reply)
Discussion started by: posix
1 Replies
10. Shell Programming and Scripting
Greetings Experts,
I am on AIX using ksh; I am processing the input files and generating a awk_output.txt file using AWK. By reading that awk_output.txt file, I am building a output.html file which is cat and then fed to /usr/sbin/sendmail .When the shell script is triggered through command... (2 Replies)
Discussion started by: chill3chee
2 Replies
LEARN ABOUT XFREE86
lndir
LNDIR(1) General Commands Manual LNDIR(1)
NAME
lndir - create a shadow directory of symbolic links to another directory tree
SYNOPSIS
lndir [ options ] fromdir [ todir ]
DESCRIPTION
The lndir program makes a shadow copy todir of a directory tree fromdir, except that the shadow is not populated with real files but
instead with symbolic links pointing at the real files in the fromdir directory tree. This is usually useful for maintaining source code
for different machine architectures. You create a shadow directory containing links to the real source, which you will have usually
mounted from a remote machine. You can build in the shadow tree, and the object files will be in the shadow directory, while the source
files in the shadow directory are just symlinks to the real files.
This scheme has the advantage that if you update the source, you need not propagate the change to the other architectures by hand, since
all source in all shadow directories are symlinks to the real thing: just cd to the shadow directory and recompile away.
The todir argument is optional and defaults to the current directory. The fromdir argument may be relative (e.g., ../src) and is relative
to todir (not the current directory).
If you add files, simply run lndir again. New files will be silently added. Old files will be checked that they have the correct link.
Deleting files is a more painful problem; the symlinks will just point into never-never land.
OPTIONS
-silent
Normally lndir outputs the name of each subdirectory as it descends into it. The -silent option suppresses these status messages.
-silent may be abbreviated to -s.
-ignorelinks
If a file in fromdir is a symbolic link, lndir will make the same link in todir rather than making a link back to the (symbolic
link) entry in fromdir. The -ignorelinks option changes this behavior. The link created in todir will point back to the corre-
sponding (symbolic link) file in fromdir. If the link is to a directory, this is almost certainly the wrong thing. The -ignore-
links option may be abbreviated to -i.
-withsymdirs
If a file in fromdir is a symbolic link to a directory and the -withsymdirs option is specified, lndir will shadow the directory
tree the symbolic link points to, whether or not the -ignorelinks is also specified. The -withsymdirs option may be abbreviated to
-d.
-clean lndir will remove dangling symbolic links and empty directories in the shadow tree. The -clean option may be abbreviated to -c.
-cleanonly
lndir will do the cleaning phase only, not creating the shadow tree. The todir argument may be provided, and defaults to the cur-
rent directory when not provided.
-withrevinfo
lndir will normally not shadow any BitKeeper, RCS, SCCS, CVS, CVS.adm and .svn subdirectories, nor any .cvsignore and .gitignore
files. This option causes these directories and files to be treated as any other, rather than ignored. -withrevinfo may be short-
ened to -r.
-noexceptions
By default, lndir does not shadow files or directories whose name is .DS_Store, or ._.DS_Store, or starts with '.#', or ends in '~'.
This option, which may be abbreviated to -E, causes such files to also be shadowed.
-except
This option adds name to an initially empty list of filenames in fromdir that are not to be shadowed. -except may be specified as
-e. This option may be repeated as many times as necessary.
DIAGNOSTICS
The program displays the name of each subdirectory it enters, followed by a colon. The -silent option suppresses these messages.
A warning message is displayed if the symbolic link cannot be created. The usual problem is that a regular file of the same name already
exists.
If the link already exists but doesn't point to the correct file, the program prints the link name and the location to which it does point.
XFree86 Version 4.7.0 LNDIR(1)