1833556 Members
3326 Online
110061 Solutions
New Discussion

Re: File links

 
Singaram
Advisor

File links

I receive a file in a specific directory (say Receipt) thru an applciation process from a remote server. This file is deleted and recreated every time the application sends the file.

I have a hard link to this file in my other directory (called as send) and i FTP it to another server.

Since every time the file is recreated the the files are not linked. I end up sending the old file it self.

I dotn want to use a soft link (-s).

Any ideas?

Thanks
Singaram
6 REPLIES 6
Patrick Wallek
Honored Contributor

Re: File links

Why worry with links at all? Why not just look for the file in the directory it is dropped into and copy it from there?
Singaram
Advisor

Re: File links

Pat

It is not a single file. It is a variable directory aswell. I need to use only link..

Thanks
Singaram
Stephen Keane
Honored Contributor

Re: File links

Get the application that creates the directory/files to also create a manifest at the same time, in a known location. You can then use the manifest to ftp the files.

Why don't you want to use a sym link?
Fred Martin_1
Valued Contributor

Re: File links

A file is not really deleted until the original file -and- it's hard links are deleted.

Try this:
# touch realfile
# ln realfile linkfile
# ls -il realfile linkfile

(note the same inode on both files)

It doesn't matter which one you delete, the inode stays until the last one is deleted.

A sym link is just a link; when the ftp process deletes and re-creates the file, the symlink still points to the name, not the old or new inode.
fmartin@applicatorssales.com
Georg Tresselt
Honored Contributor

Re: File links

Why do you dislike soft links? It might be the magic fix for your problem.
http://www.tresselt.eu
Singaram
Advisor

Re: File links

Hi all

Thanks for all your reply.
May be i have to settle down with symbolic link.

I validate the received file based on the date and time of the file size to check it is a fresh file or the same old file.

But sym link doesnt change when new file arrives.

I should change my logic to diff the current file with last processed file for validataion.

Singaram