![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| 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 | 08-21-2008 02:44 PM |
| Search for a File Name in a folder | sbasetty | Shell Programming and Scripting | 1 | 07-13-2007 05:43 PM |
| file name in folder | u263066 | Shell Programming and Scripting | 5 | 10-12-2006 08:37 AM |
| Take a folder name and find it in another folder (Complicated) | hkhan12 | Shell Programming and Scripting | 5 | 09-06-2006 12:25 PM |
| getting a file name from a folder | u263066 | Shell Programming and Scripting | 4 | 08-14-2006 11:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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! |
|
||||
|
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! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|