LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-04-2010, 08:15 AM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Rep: Reputation: 255Reputation: 255Reputation: 255
issue with mv: "inter-device move failed, unable to remove target: Is a directory "


Hello,

when i try to move my picture folder from my camera to my home dir, i use this command

Code:
mv -f ~/pictures /mnt/1tbdiskbackup/
 
Old 12-04-2010, 10:32 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
From camera to home dir is:
Code:
mv -f /mnt/1tbdiskbackup ~/pictures
If it will not work, maybe you cannot remove this directory from camera, use:
Code:
mv -f /mnt/1tbdiskbackup/* ~/pictures/1tbdiskbackup
 
Old 12-05-2010, 02:17 AM   #3
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by eSelix View Post
From camera to home dir is:
Code:
mv -f /mnt/1tbdiskbackup ~/pictures
If it will not work, maybe you cannot remove this directory from camera, use:
Code:
mv -f /mnt/1tbdiskbackup/* ~/pictures/1tbdiskbackup
OK, indeed, because ~/pictures/1tbdiskbackup exists already, but how to merge the folders with a possibility of overwritting or either labelling *.1,2,... for cases of same filename ?
 
Old 12-06-2010, 02:46 AM   #4
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
This should move them and avoid overwriting. (untested.)
Code:
#!/bin/bash
declare -i counter=1
getdir="/mnt/1tbdiskbackup/"
putdir="$HOME/Pictures/"
find $getdir -maxdepth 1 -type f | while read pic
do
  file=$(basename $pic)
  if [ -e $putdir$file ]
  then
    mv $getdir$pic $putdir$pic-$counter
    counter=$counter+1
  else
    mv $getdir$pic $putdir$pic
  fi
done

exit 0
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with "mv: inter-device move failed: " frenchn00b Debian 5 01-22-2019 04:07 AM
detect usb device insert/remove and get device node from "C" program ebinjose Linux - Embedded & Single-board computer 4 04-29-2012 08:26 AM
[SOLVED] move all ".txt" files, adding parent directory to filename mostofmonty Linux - Newbie 9 09-15-2009 08:39 AM
can't remove dir ") and _REMOTE_USER_") from failed install bambino59 Linux - Security 2 10-17-2006 10:31 AM
"Unable to open USB device "usb://hp/LaserJet%201000": No such device" lordshipmayhem Mandriva 2 08-08-2004 04:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration