in my system after some time the new file is generating
ans the naming convention can be of any type of that file
so what i need i just want to make a script which will run and copy the current file to my folder cany any one tell me how to do this ...........
Note: In the above command event the sub directories would be included
or
ls -ltr <path> >result # this will give you the last line as the most recent file
sed -n '$p' <path/filename>| awk '{print $9}' | read filename#this will give you the filename
cp filename <target folder>
i am already in that director where i want the latest file.
so i am using this command but its not working properly can any body tell me whats wrong in this. #ls -lrt|sed -n '$p' |awk '{print $9}' |read abc |cp abc /home/SHARY/
but after executing this command it will give the message
cp :cannot stat 'abc' :no such file or directory
this should work from where ever you are in the database. if you hit cd <enter>
this will place you in your home directory. from there type the word set
you might do a set | page you can view it slowly. Look for OLDPWD this is where it will be placed