I am using Cygwin as Linux shell, I have following contents in my current working directory:
Files :
Abc.dat
123.dat
456.dat
Directories:
W_Abc_w
W_123_w
W_456_w
Now I want to copy files as below:
Abc.dat -> W_Abc_w
123.dat -> W_123_w
456.dat -> W_456_w
How to achieve this in a single line linux command? I need a generic solution which can be used for similar cases in future...
Destination directory always exists, but number of characters in file name will vary. Destination directory name will always contain the file name of file to be copied along with other extra characters.
Destination directory names have unique pattern eg. Abc_sa_file_name_1 second directory name will be Abc_sa_file_name_2. File names also has pattern e.g kim_1. Kim_2 .
I will be moving or copying file kim_1 to Abc_sa_kim_1_1. I wish to operate complete pattern in one command.