Search code examples
mv

move only specific folders and subfolders using mv


I am trying to move specific folder and subfolders from a directory. In the below I am trying to move a folder BAM and its two subfolders and another folder Bedtools from the main directory to a destination but getting the errors below. Thank you :).

folder structure

 8-21-2016 -- Top level is date
 BAM -- parent directory
 Coverage  --child directory
 Validation -- child directory
 Bedtools  -- parent directory 
 Test  -- parent directory
 ID  -- parent directory

mv -u /home/cmccabe/Desktop/NGS/API/6-10-2016/bam/* bedtools/ /media/cmccabe/"My Book Western Digital"
mv: inter-device move failed: ‘/home/cmccabe/Desktop/NGS/API/6-10-2016/bam/coverage’ to ‘/media/cmccabe/My Book Western Digital/coverage’; unable to remove target: Is a directory
mv: cannot stat ‘bedtools/’: No such file or directory

Solution

  • Apparently bedtools does not exist in your local path. And about the other error message mv: inter-device move failed: ‘/home/cmccabe/Desktop/NGS/API/6-10-2016/bam/coverage’ to ‘/media/cmccabe/My Book Western Digital/coverage’; unable to remove target: Is a directory, probably that folder is not writable for your user. Move mv command will remove it from the device but probably you don't have the rights.

    Check trying as root (with sudo) for the second problem. For the bedtools folder, please check your local path.