I apologize. I assumed that you had read through the thread that you copied my code from:
Moving files from parent path to multiple child path using bash in efficient way and that you were trying to do something similar, but copying CSV files instead of TXT files. What that thread was doing was to move files from one place in a file hierarchy up one level (removing one intermediate directory in the source path) to another set of pre-existing directories in that same source file hierarchy.
With your latest set of changes to my script, you are apparently trying to move files from
/home/user/pumela to
/home/user/pumela/home/user/pumela and, since
/home/user/pumela/home/user/pumela is not an existing directory, the script exits because there is nothing to do. And, whereas in post #1 in this thread
/home/user/pumela/archive was a target directory; in this latest set of changes to the script, it is some kind of regular file that stores the output produced by the most recently run
cd command???
So, let's go back to step 1! Please forget about the script that you copied and tell us exactly what you are trying to do:
- What directory or directories contain files that you want to move?
- To what directory or directories do you want to move those files?
- Are the files you want to move on the same system as the directory or directories to which you want to move them?
- Is or are the target directory or directories on the same filesystem as the directory or directories that contain the files your want to move?
- Is cygwin (running under some version of Windows) the only system on which you want to run this script? If not, what other systems will you be using to run this script?
PS The title of this thread is "
Issues in Csv file transfer copy from one dir to another". "Move" and "transfer copy" are two different things. Do you want to
move files or do you want to
copy files?