I'm new to the linux & command world. I have two directories, one called pasta (which contains 3 files) and another one called pasta2 (with nothing inside). I'm trying to move all 3 files from pasta to pasta2 with the command find. But i get the error bellow. Any suggestion?Command:find pasta -type f -exec mv pasta2 {} \;and i get this output:mv: cannot overwrite non-directory `pasta/tmp3' with directory `pasta2'mv: cannot overwrite non-directory `pasta/tmp1' with directory `pasta2'mv: cannot overwrite non-directory `pasta/tmp2' with directory `pasta2'
Linux shell - unexpected error
shell script;find;rename
You have the syntax for mv wrong. It should be:mv source destinationYou are runningmv destination sourceTherefore, the find command is actually runningmv pasta2 pasta/tmp3mv pasta2 pasta/tmp2mv pasta2 pasta/tmp1It is complaining that you are trying to overwrite (mv) a directory with a regular file. What you actually want to do isfind pasta -type f -exec mv {} pasta2 \;This will executemv pasta/tmp3 pasta2mv pasta/tmp2 pasta2 mv pasta/tmp1 pasta2 which should run with no errors.