| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

03-07-06, 00:20
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 17
|
|
|
pickup file from folder
|
|
Hi,
Can any body help me,How to pickup file from folder using shellscript.
FolderName:/test
FileinFolder: test.txt
MY req is  hellscript pickup file from folder and pass file as parameter to java program..?
Thanks,
Rams
|
|

03-07-06, 14:09
|
|
Registered User
|
|
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
|
|
Try somethiing like:
Code:
#!/bin/ksh
file=/test/test.txt
java com.domain.MyApp****nJob $file
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
|
|

03-08-06, 01:17
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 17
|
|
|
|
file=/test/test.txt
java com.domain.MyApp****nJob $file
if i give this in java its taking file as /test/test.txt
i wanted to take only file as test.txt
Thanks lot
Rams
|
|

03-08-06, 04:27
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
Code:
#!/usr/bin/ksh
file1=/test/test.txt
##
FolderName1=$(dirname $file1)
FileinFolder1=$(basename $file1)
echo $FolderName1 $FileinFolder1
## OR
file2=/test/test2.txt
FolderName2=${file2%/*}
FileinFolder2=${file2##*/}
echo $FolderName2 $FileinFolder2
|
|

03-08-06, 06:11
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 17
|
|
Hi pdreyer,
Thanks lot ,here iam getting file name but not getting content in file,empty file name is giving...?
Thanks
Rams
|
|

03-08-06, 16:08
|
|
Registered User
|
|
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
|
|
Like this?:
Code:
#!/bin/ksh
cd /test
file=test.txt
java com.domain.MyApp****nJob $file
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
|
|

03-09-06, 02:00
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
Quote:
|
here iam getting file name but not getting content in file
|
Yes, my code just show you how to delete any prefix ending in / or to deliver all but the last level of the path name.
Replace the echo command with the java command and pass the file name as argument as in the sample from LKBrwn_DBA
|
|

03-09-06, 09:05
|
|
Registered User
|
|
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
|
|
Better show us your code.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
|
|

03-27-06, 02:31
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 17
|
|
Thanks guys,
I need one more clarification...
My files dumped into folder FileName followed by Timestamp.That is the case how to pick up file from folder and pass to javaprogram...?
ThanksLot
|
|

03-27-06, 02:55
|
|
Registered User
|
|
Join Date: May 2005
Location: South Africa
Posts: 1,268
|
|
I do not understand your question. Do you want to find the latest file in the directory?.
|
|

03-27-06, 04:17
|
|
Registered User
|
|
Join Date: Oct 2005
Posts: 17
|
|
Hi pdrey,
that's correct ,I want to pickup latest file from Folder..
ThanksLot
|
|

03-27-06, 10:03
|
|
:-)
|
|
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,454
|
|
Quote:
|
Originally Posted by ram2s2001
that's correct ,I want to pickup latest file from Folder..
|
Like this?
Code:
#!/bin/ksh
cd /test
ls -1t | read file
java com.domain.MyApp****nJob $file
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|