
December 29th, 2011, 03:13 PM
|
|
Registered User
|
|
Join Date: Dec 2011
Posts: 5
Time spent in forums: 49 m 28 sec
Reputation Power: 0
|
|
Ftp session to append data after an ls output
How to append a directory name after an ls ouptut results?
directory.txt file contains 2 records.
May
June
Once inside the ftp session.
The May directory includes a text file called 5.txt
The June directory includes a text file called 6.txt and 106.txt
How to get results inside out.txt?
5.txt,May
6.txt,June
106.txt,June
Here is the script:
DIRECTORY=`cat directory.txt|sed '/^$/d'`
(
exec 4>&1
ftp -n>&4 2>&4|&
print -p open $host
print -p user $user $password
print -p binary
for D1 in $DIRECTORY; do
print -p cd "$D1"
print -p ls|awk '{print ",$D1"}' #This doesn't work
done
print -p bye
wait
)>>"out.txt
|