hi guys i want a script manually copy all directories and files. Dont want to use cp-r, cp-R or any variant. How to do this, the piece of code i need is commented in the script
Code:
#!bin/bash
IFS=$'\n'
if test "$1" = ""
then
wd=pwd
else
wd=$1
fi
for file in $(find $1)
do
if [ -f $file ]; then
cp $file ~/Desktop
elif [ -d $file ]; then
#copy directory,subdirectory and files wihtout
#using cp-r, cp-R or any variant
mkdir ~/Desktop/$file
fi
done
thanks in advance
---------- Post updated at 10:17 AM ---------- Previous update was at 09:38 AM ----------
Something like, when a directory is found elif [ -d file ]; then
look in that directory if it contains more files or folders
create or copy folder and also containing files and folders
---------- Post updated at 11:49 AM ---------- Previous update was at 11:41 AM ----------
Avans highschool breda, the netherlands
course os1 exercise 4