bash script to copy files
Hi,
i want to write a bash script to copy files, but i encounter a minor problem. My command "mycp source destination" and check for the existence of the file being copied to the new location. eg mycp ~/dir1/file1.txt ~/abc/dir2 If in dir2 has file1.txt it should automatically be file2.txt (i want to increment the number because I tried with style file1.txt.bak but don't like the look of the extension) otherwise just do the normal copy. One more thing how do i break down the $2 (ie: ~/abc/dir2/file.txt or ./def/dir2/file.txt) as directory and file. coz i want too have a prompt if the directory doesn't exist either create or terminate.
Thanks.
|