Need help writing Unix Shell script to pass file name,path,creation date !
Hi there
I'm new to UNIX scripting; I’m stuck with the following I have an Oracle SQL script that takes three parameters 1- File Name 2- File Path 3- File creation date Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need is a UNIX script that can do the following Loop through Directory "/home/applmgr/snktmp" Picks only files Pass the file name to parameter &1 Pass the file path to parameter &2 Pass the file creation date to parameter &3 Call Oracle Script passing parameters &1,&2,&3 End loop Is the above possible? I already knows how to call the Oracle Script from UNIX I’m only stuck on writing the UNIX part where it List the files attribute(name,path,date) and store them to parameters ,Looping until the last file in the directory If the above is not possible,then how can I create the below from the command line Filename{concatenation Mark}filePath{concatenation Mark}creationdate Filename{concatenation Mark}filePath{concatenation Mark}creationdate Filename{concatenation Mark}filePath{concatenation Mark}creationdate Filename{concatenation Mark}filePath{concatenation Mark}creationdate Thanks |
Would
Code:
find -type f -printf "$ORACLE_CMD %h %f %c\n" |
hi
can you explain the line ? what does it do ! i have subtituted the $ORACLE_CMD with directory , but i'm not getting the following error Usage: find [-H | -L] path-list [predicate-list] Thanks |
Yeah - that should have been
Code:
find PATH_TO_FILES -type f -printf "ORACLE_CMD %h %f %c\n" However, this is actually dumb - it does isolate the data you want (I think) and can generate a secondary script you can use (redirect the output of the command to a file, chmod file, execute file) but doesn't do anything itself. If that isn't sufficient (and it probably isn't) I'll see about something more sensible. ;) -- And maybe you can explain something to me - what does this mean? Quote:
|
@OP; just FYI, there's no such thing as creation date in *nix.
You've got ctime, mtime, atime see eg http://linux.die.net/man/1/find, none of which are creation time... |
All times are GMT -5. The time now is 05:00 PM. |