Linking Automation

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Linking Automation
# 1  
Old 09-11-2013
Linking Automation

How to link the files automatically in linux on daily basis ?

For example :
I have file abc.20130911.txt
ln -s source/ abc.20130911.txt  dest/abc.20130911.txt

But in my machine files will be generate with date time stamp every day, without manual linking every day is there any possibility to link the files with the date time stamp automatically which generate latest ?

If any help that would be great thanks !!!
# 2  
Old 09-11-2013
Do you want ALL the files to be linked or just the newest one?
You can obviously run a script that would check all the files in the source dest if appropriate file exist in dest dir and if not, create a link.
# 3  
Old 09-12-2013
Try this:
for file in src/*
  filename=$(basename $file)
  [ ! -f dest/$filename ] && ln -s $file dest/$filename

# 4  
Old 09-12-2013
I would like to link the files which are available in the source location when it arrives doesn't matter. Once the file available in the source location it should be linked to the specified destination location, file can arrives today or tomorrow and so on. Files can be recognized abc.20130912.txt and abc.20130913.txt for today and tomorrow so on.

I don't want to run any script, it should be one time activity.
For example : for today's file i can link as " ln -s source/abc.20130912.txt dest/abc.20130912.txt " on the same lines is there any way that we can link as below "ln -s source/abc.$(date + %Y%m%d).txt dest/abc.$(date + %Y%m%d).txt" for all the days???

Note: I have around 300 files to link and with different names. every day same files will be created with different date stamp.
# 5  
Old 09-12-2013
Symbolic links cannot automagically create themselves. Something has to create them.

If all you want is the same folder in a different place, why not symbolically link the entire directory instead of its individual contents?

# Create an empty folder 'a'
$ mkdir a
# Create the empty file 'b' inside it
$ touch a/b
# 'newdir' is a symbolic link to 'a'
$ ln -s a newdir
# running ls on it shows a's contents
$ ls newdir


# If you create a new file in a, it shows up in newdir too
$ touch a/c
$ ls newdir


# If you create a new file in newdir, it shows up in a too
$ touch newdir/d
$ ls a



It's also possible to do something similar with mount tricks, but that's likey overkill.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

Linking .so into C program

I have a C binary file(.so as extension) which is delivered by a product. How do i use this functionalities of this .so file in my C program? How can in link the .so to my C program? (1 Reply)
Discussion started by: vkca
1 Replies

2. Programming

Linking problem

Hi! We recently updated the server (server is a big word, it's really just a desktop with Ubuntu that we access with ssh) on which we compile our code. Since the update my code won't compile. The linker is complaining about missing references from almost all .so that I'm linking from. It... (0 Replies)
Discussion started by: philippevk
0 Replies

3. Solaris

g++ linking problem...

I use Solaris 10, compiling with a custom g++ (3.4.6) and GNU binutils (2.17). Things have gone well on two different systems, but when I tried moving to a third, it all fell over. Basically, it is now using the CC linker, but I need to use options not available to it. I believe I have found the... (0 Replies)
Discussion started by: Elric of Grans
0 Replies

4. UNIX for Dummies Questions & Answers

is linking possible?

how would i link 2 files together? is it the same as copying? (1 Reply)
Discussion started by: trob
1 Replies

5. AIX

linking problem

hello, Is the code compiled under Visual Age C++ Broker (a third party library) - can be used to link against a code compiled from gcc compiler. I have a problem in building xerces in AIX Please reply. Regards, Parthasarathy (1 Reply)
Discussion started by: Parthasarathy
1 Replies

6. Solaris

linking in solaris9

at the end of the compilation in solaris 9. it is showing link error. like..... ld: fatal: library -lgthread-2.0 not found failed to create the binary the library is in /usr/lib and in /usr/local/lib the lib file is present ---> ......etc if i remove... (3 Replies)
Discussion started by: biswajithit
3 Replies

7. Programming

Linking with gcc

Forgive as I am new to the gcc compiler and to linux. I am trying to compile/link a program for the first time and am receiving an error complaining about the crtbegin.o file. I use the -v option and get the following: Using built-in specs. Configured with: ../configure --enable-threads=posix... (1 Reply)
Discussion started by: jbeauchamp
1 Replies

8. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies

9. UNIX Desktop Questions & Answers

Linking Directories...

Hi there, I am very new to UNIX. Currently, I am running Mac OS X. I set up a FTP server on my computer so that I can transfer files back and forth between my computer at home and at work. All my data and files are located in a directory in another drive, but when I log in, I would be in my... (3 Replies)
Discussion started by: floppiless
3 Replies
Login or Register to Ask a Question