Script problem due to recursive directories Help please
Hello everyone , I am looking for a better solution then the one I have created for the my Task
The task is:
Create an automated script that will check for Uploads in a specified Directory and move them to another specified Directory if the files are completely uploaded.
Files are FTP'd to the Specified directory
Multiple FTPS could be running so knowing if a particular FTP is complete is difficult for me to check by Process ID
I created the script listed below , but can see that issues can arise with Uploads of Trees
for instance
If the Upload directory has the following:
I am not sure , but if the last changed date of the stat command on a directory is older then the Age I am looking for
then shouldn;t that mean
that any file and sub directories below that Directory will be completely uploaded and also older then the Age I am looking for ?
...... I hope that made sense....
I do not think that is the case though....
I am hoping there is a better way to deal with this issue.
Hello... I would tackle this problem in PERL, but for now I wanted to address options for knowing if the file upload is complete... The usual way to do this is to have the person or software that does the uploading to RENAME (ftp REN command) to another directory in the same file system. Because a RENAME (like a mv move in the shell) only changes pointers, the process is instantaneous and so if the file appears in the moved-to directory, you know it must be complete....
so for example...
../uploaddir/commitdir
You UPLOAD files to the uploaddir and when the upload is finished issue a command like ftp> REN uploadedfile commitdir/uploadedfile
Your process polls commitdir, not the uploaddir. If a file appears in commitdir, you know it must be fully uploaded and closed.
Hello quine, thanks for the response,
The problem I have is that I want to have a cron job run this script
and the directory that the files are moved to are not visible nor accessible by the uploader. Once the files are uploaded and moved, the uploader no longer has access to them. (well accept for the small timeframe between cron jobs approx. 1-5 minutes max)
A perl solution would be acceptable to me, accept I have coded only one module in perl in my life , You probably heard of it..... "Hello World"
Shell scripting I can muddle through as you can see by the script I have written so far.
So any example even in perl would benefit my issue.
thanks again
So I have extremely limited experience with shell scripting and I was hoping someone could point out a few commands I need to use in order to pull this off with a shell script like BASH or whatnot (this is on OS X).
I need to search out for filenames with account numbers in the name itself... (3 Replies)
hi;
i need a script which will go to all directories and subdirectories and print the filenames as follow;
here i m printing only files listing in current directory
reason i m doing this is coz i want to perform some operations according to filename achieved so cant use find command;... (4 Replies)
Hi,
I've been searching through out this forum to find the exact message when during the on-going FTP, suddenly the network went down but i cannot find some. Could anyone provide me the exact return codes when FTP failed during FTP or prior to FTP the network went down and you still proceeded to... (3 Replies)
find -type d -name "TC_*" | sort
That's what I have so far... it finds the appropriate directories and then sorts them. But, when it comes to nested subdirectories, it only sorts relative to the first subdirectory. I want it to sort based on the directory at the end of the path. Does anyone know... (3 Replies)
Hi everyone,
Maybe this is simple question for many of you, but I get confused.:confused:
How to archive a parent directory which contains some subdirectories and some files?
I have searched this forum, there are some commands like tar,etc, I tried but can not be implemented in my system.... (6 Replies)
I think I've seen out there that there is a command to ignore specific files within a directory when doing a (-R) recursive diff. I've never used this so I was wondering if there was anyone who could provide an example how I would run this. My thoughts are something like:
cvs diff -i <fileName1>... (2 Replies)
################################################################
Copy this script to your path from where you want to search for all the files and directories in subdirectories recursively.
#################################################################
code starts here... (2 Replies)
Hi,
I have developed a datastage job...which has many process running in parallel..but because of Fork Error my job is not working:(
Can any body help me out to solve this Fork error problem.:rolleyes:
My Os is SUNOS.
IS there any setting in Unix through admin where in if i set some paramter... (8 Replies)
The man page for chmod doesn't list a way to recursively change permissions on directories only, without affecting the files themselves.
Let's say that I wanted to change the permissions on the current directory and all subdirectories. I know I can write a bash script that would do this using... (1 Reply)
I am trying to locate a file or files with specific data in them. Problem is the file(s) could reside in any one of many directories.
My question is. Is there a way of recursively greping directories for the file(s) with the data I am looking for.
I have tried -
1.
$HOME> grep 47518 | ls... (8 Replies)