Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-27-2006, 11:11 AM   #1
LQ Newbie
Registered: Jul 2006
Posts: 2

Rep: Reputation: 0
Script for file move after FTP


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,

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

Rep: Reputation: 33
This has been posted twice, see .
Old 07-27-2006, 11:42 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.3
Posts: 17,548

Rep: Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423
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.


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 12:01 PM
Using BASH script to transfer a file via (s)ftp senther Linux - Newbie 2 07-19-2005 04:47 PM
How to write a shell script to download a file via FTP? guarriman Linux - General 4 12-21-2004 09:31 AM
making a script that will move a file or files in a trash folder Paxmaster Programming 5 12-12-2004 06:00 PM
Need script to dump database, ftp file to backup server glock19 Linux - Networking 17 05-12-2003 05:56 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:18 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration