Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Name: nails Date: November 5, 2009 at 07:21:01 Pacific
Reply:
I am assuming that the objects in your existing folder are only files and directories.
#!/bin/ksh
cd <your existing folder>
myvar=$(ls -1t|while read obj
do
echo $obj
break
done)
echo $myvar
0
Response Number 2
Name: tvc Date: November 7, 2009 at 02:33:00 Pacific
Reply:
lastfile=`ls -1tr | tail -n 1`
would give the last updated file or directory in the current directory, and store it in variable
0
Response Number 3
Name: sushilanand Date: November 8, 2009 at 20:51:41 Pacific
Reply:
Thanks for the help, appreciate if you pls let me know - I need to copy files from the existing non-empty folder to existing empty folder (created recently).
Thanks.
0
Response Number 4
Name: tvc Date: November 9, 2009 at 09:29:19 Pacific
Reply:
Is that a new request, or does it relate to the previous question ?
Just use CP, no ?
0
Response Number 5
Name: sushilanand Date: November 9, 2009 at 19:41:14 Pacific
Reply:
Hi
But how would I check the latest empty folder and non empty folder. I need to write a scrip, first to check the non empty folder and copy files from there to latest empty folder.
Thanks in advance.
0
Response Number 6
Name: tvc Date: November 10, 2009 at 03:39:31 Pacific
Reply:
That's a totally different question than the one from the initial post !
And also, somewhat more difficult. So, you need to know the name of the latest non-empty directory ?
One way would be to explicitally create one ... but that may not be acceptable as a solution. I'll have a think
0
Response Number 7
Name: sushilanand Date: November 10, 2009 at 19:46:43 Pacific
Reply:
Hey...
I have done that... thanks a lot for your prompt support.
Regards
0
Response Number 8
Name: tvc Date: November 11, 2009 at 03:37:45 Pacific
Reply:
OK, good ... take care that if you create a folder, it may already be there !
In that case, it may not be empty, and if it is empty, it may not be the most recent folder ...
Summary: Hi there, I have a program which will write some log information to a log file. The problem is this log file grows too fast. But the log information is necessary to me. What I want to do is trying to ...
Summary: i have a file in unix in which datas are like this 07 01 abc data entry Z3 data entry ASSISTANT Z3 39 08 01 POD peadiatrist Z4 POD PeDIATRY ...
Summary: Hi, i have ksh script to fetch the data from oracle database and store the output in a .xls or .csv file. But the output having more then 70,000 rows. How can i store those files in .xls or csv files....