Stephan 'smg' Grein wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> phillip.s.powell@gmail.com wrote:
> > # NOW WE COPY EVERYTHING OVER TO THE NEW FOLDERS IN $csvBackupPath
> > cp -pr "$clientDocPath/*.csv" "$csvBackupPath/clientCSV"
> > cp -pr "$projectDocPath/*.csv" "$csvBackupPath/projectCSV"
> >
> Try that:
> cd "$clientDocPath/" && for file in *.csv; do cp -p "$file"
> "$csvBackupPath/clientCSV/${file}"; done
> cd "$projectDocPath/" && for file in *.csv; do cp -p "$file"
> "$csvBackupPath/projectCSV/${file}"; done
you may get into trouble if "$projectDocPath" is not an absolute path.
to keep the current directory info, you may want to use sub-shell with
your commands, like
( cd "$clientDocPath/" && for file in *.csv; do cp -p "$file"
"$csvBackupPath/clientCSV/${file}"; done )
Also, using 'find' might save OP some typing:
find "$clientDocPath" -type f -name "*.csv"
-exec cp -p "{}" "$csvBackupPath/clientCSV/" \;
or use find | xargs, find -exec ... + .....
(untested)
Xicheng