i use this function to delete contents of directory
with too much stuff for bash.
Code:
cd /home/xfers/directory_with_lots_of_files
function delete_all ()
{
while read line1; do
echo $line1
rm /home/xfers/directory_with_lots_of_files/$line1
done
}
ls -l /home/xfers/directory_with_lots_of_files | delete_all
i want to use it to pass the filenames of the first
and last files now in this directory to two variables.
find errors out as there are many thousands of files
in the directory. this is what i've changed it to for
starters:
Code:
cd /home/xfers/directory_with_lots_of_files
function find_first ()
{
while read line1; do
echo $line1
done
}
ls -l /home/xfers/directory_with_lots_of_files | find_first
this does fine at printing a directory listing and
i can change the final line to 'ls -rl' to do a
reverse listing, but i can't seem to retain the
first or last value as a variable. how would i pass
the value of the last file listed by this function
using either the 'ls -l' or 'ls -rl' form? knowing
those, i could pass the first and last filenames in
this large directory on for further processing but
i seem to be stuck.
thanks,
BabaG