trying to copy all the files without extension then add
"*.txt" but its not working is there any other way and i do not want to use
cpio -vdump just want to use copy command
FROM=/usr/share/doc
TO=/aleza/doc
#the follow function copies all the files without extensions
call(){
cd $FROM
find . ! -name "*.*" -type f | cpio -vdump /swepa/doc
}
#this func add the "*.txt" extension
me(){
cd $TO
for i in * ; do
echo mv \"$i\" \"$i.txt\" | sh
done
}
call
me
As you can see, find will also print the path to the file in the output. To "solve" this, you can use the -printf option, but there is a problem, depending on your OS, this option will not be available:
# -printf arguments
# %h -> Path to the file
# %f -> Filename
find . \! -name "*.*" -type f -printf "cp %h/%f ${TO}/%f.txt\n" | sh