- Code: Select all
cd `find . -name "filename*" -print`
To change to a directory where a file is. However, how can I use the find file in a script to locate the file and then copy it to another directory?
cd `find . -name "filename*" -print`

find . -name ff.notes
./ff.notes
find `pwd` -name ff.notes
/home/jj/ff.notes
cp $(find `pwd` -name ff.notes) Documents/
find `pwd` -name ff.notes
/home/jj/Documents/ff.notes
/home/jj/ff.notes
cp $(find . -name ff.notes) Documents/


Users browsing this forum: No registered users and 1 guest