Tag Archives: PURPOSE

Cp: cannot stat No such file or directory

By Rami Reddy

Hi

Please review this script and let me know what i need to do.
This is my script

Code:

#!/bin/bash
#SCRIPT: forms.sh
#PURPOSE: Process a file line by line with redirected while-read loop.
#PURPOSE: and copy the forms to the follder

foldername=sample_dir
mkdir -p $foldername

while read file;
do
FILENAME=$(basename $file)

LINE=$FILENAME
count=0

cp $LINE $foldername/
done < forms.txt


i have a file called forms.txt which contains unix directory path.
i want to extract the filename alone from the unix directory path. now i am having copy issue with this script.
This is the error, i am getting

Code:

cp: cannot stat `AKDAPREG.fmb': No such file or directory
cp: cannot stat `AKDATTRS.fmb': No such file or directory
cp: cannot stat `AKDFLOWB.fmb': No such file or directory
cp: cannot stat `AKDFLOWS.fmb': No such file or directory
cp: cannot stat `AKDOBFKS.fmb': No such file or directory
cp: cannot stat `AKDOBJWB.fmb': No such file or directory
cp: cannot stat `AKDOBPKS.fmb': No such file or directory
cp: cannot stat `AKDPICKF.fmb': No such file or directory
cp: cannot stat `AKDQUERY.fmb': No such file or directory


Please let me know your suggestions.

Thanks,
Rami Reddy.

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums