![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto copy for files from folder to folder upon instant writing | Bashar | UNIX for Advanced & Expert Users | 2 | 2 Weeks Ago 11:44 AM |
| Search for a File Name in a folder | sbasetty | Shell Programming and Scripting | 1 | 07-13-2007 02:43 PM |
| file name in folder | u263066 | Shell Programming and Scripting | 5 | 10-12-2006 05:37 AM |
| Take a folder name and find it in another folder (Complicated) | hkhan12 | Shell Programming and Scripting | 5 | 09-06-2006 09:25 AM |
| getting a file name from a folder | u263066 | Shell Programming and Scripting | 4 | 08-14-2006 08:10 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Parse the .txt file for folder name and FTP to the corrsponding folder.
Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and suffix are of a fixed size.
e.g: 1) 20070701greenfieldincfile.txt (Folder Name: greenfieldinc) 2) 20070701oldenergycorpfile.txt (Folder Name: oldenergycorp) Detailed Request: 1) Parse the Input File name and Find the name of the folder. 2) FTP to Windows server and place the text file in the corresponding folder. 3) Put the whole process in loop until it processes all files. 4) If possible any error check conditions or logs. Thank you for your support! |
| Forum Sponsor | ||
|
|
|
|||
|
Try this
#!/usr/bin/ksh
ls -1 *file.txt | while read FILENAME do DIRNAME=`echo "$FILENAME" | sed -n 's/........\(.*\)file.txt/\1/p'` echo "starting FTP of $FILENAME to Directory /tmp/$DIRNAME ..." ftp -v -n host <<EOF user user pwd cd /tmp/$DIRNAME #destination Dir lcd /tmp/source/ #source dir put "$FILENAME" bye EOF done |
|
|||
|
Grant File privileges
The provided script did work. Thank You so much!
However, the created file hasn't been granted 'write' privileges to the user. The file is getting created through Oracle trigger and the process automatically uses 'dbadmin' user on UNIX. Is there any way that we can force UNIX to provide 'r' & 'w' privileges to group and other members for the files that get generated through that process or files that get generated in the specified directory. Any help is greatly appreciated. Thanks! |
| Thread Tools | |
| Display Modes | |
|
|