LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 07-27-2006, 12:11 PM   #1
lohrpr
LQ Newbie
 
Registered: Jul 2006
Posts: 2

Rep: Reputation: 0
Script for file move after FTP


All,

I would consider myself a mid-linux user. I am an Oracle DBA and have done a few installs of Oracle on linux so I am familiar with some scripting. I need a script that will move files from a directory to another directory. The catch is the first directory is a directory that many users will FTP files to, after they FTP the file, a CRON job will process the files. Some of these files will be large and may take some time to transport. I have to process the files within 2 min after the file transfer completes. I have scripts that can move files based on date or even time. My issue is if I use “ls” to find out if there are any files in the directory it will show me files that have not yet completed the file transport. Basically, I need a script that will look at a folder and determine which files have completed the file transport and not the ones that are in the middle of transport.

Any help would be appreciated,

Thanks
 
Old 07-27-2006, 02:25 PM   #2
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
This has been posted twice, see http://www.linuxquestions.org/questi...d.php?t=468272 .
 
Old 07-28-2006, 12:42 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
One option is to write a daemon that loops every minute and stat()'s the filesize. If file size hasn't changed (increased) in eg 2 loops, assume file finished txfring.
Alternatively you need some kind of file-lock mechanism.
I did this yrs ago :
client sends data file, then sends signal file eg 5 bytes (done\n), same name as data file but different extension eg '.sig'. Only pick up data files for which you have a corresponding sig file.
Delete both files (in reverse order) when processed.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot using FTP move command to move files adrianmak Linux - Networking 4 04-21-2009 01:01 PM
Using BASH script to transfer a file via (s)ftp senther Linux - Newbie 2 07-19-2005 05:47 PM
How to write a shell script to download a file via FTP? guarriman Linux - General 4 12-21-2004 10:31 AM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 07:00 PM
Need script to dump database, ftp file to backup server glock19 Linux - Networking 17 05-12-2003 06:56 PM


All times are GMT -5. The time now is 01:16 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration