LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 12-04-2011, 01:25 PM   #1
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch
Posts: 424

Rep: Reputation: 18
move directory and contents


Is there a single linux command that will move a directory and its contents to a different physical location, i.e. into another directory?
 
Old 12-04-2011, 01:43 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
yes, just "mv directory new_directory". nothing fancy at all.
 
Old 12-04-2011, 01:45 PM   #3
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,064

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Hi there,

Quote:
Originally Posted by porphyry5 View Post
Is there a single linux command that will move a directory and its contents to a different physical location, i.e. into another directory?
yes, of course - probably mv is what you're looking for.
The mv command doesn't care whether the object you wish to move/rename is a single file or a directory.

[X] Doc CPU
 
Old 12-04-2011, 02:12 PM   #4
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch
Posts: 424

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by acid_kewpie View Post
yes, just "mv directory new_directory". nothing fancy at all.
Quote:
Originally Posted by Doc CPU View Post
Hi there,
yes, of course - probably mv is what you're looking for.
The mv command doesn't care whether the object you wish to move/rename is a single file or a directory.
[X] Doc CPU
That's what I tried, and it did this
Code:
~/Films/The Tragedy of Macbeth (1971) DVD9 $mv . /media/500gb/Films
mv: inter-device move failed: `.' to `/media/500gb/Films/.'; unable to remove target: Is a directory
~/Films/The Tragedy of Macbeth (1971) DVD9 $mv '.' /media/500gb/Films/
mv: inter-device move failed: `.' to `/media/500gb/Films/.'; unable to remove target: Is a directory
~/Films/The Tragedy of Macbeth (1971) DVD9 $mv "." /media/500gb/Films/
mv: inter-device move failed: `.' to `/media/500gb/Films/.'; unable to remove target: Is a directory

Last edited by porphyry5; 12-04-2011 at 02:16 PM.
 
Old 12-04-2011, 02:13 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
you can't move the directory you are in, as calling it "." means that the destination will be "." in the destination directory, which IS the directory itself, which makes no sense.

Last edited by acid_kewpie; 12-04-2011 at 02:14 PM.
 
1 members found this post helpful.
Old 12-04-2011, 02:22 PM   #6
porphyry5
Member
 
Registered: Jul 2010
Location: oregon usa
Distribution: Slackware 14.1, Arch
Posts: 424

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by acid_kewpie View Post
you can't move the directory you are in, as calling it "." means that the destination will be "." in the destination directory, which IS the directory itself, which makes no sense.
Thanks, got it now. It has to be like so, from a different directory
Code:
mv "/home/g/Films/The Tragedy of Macbeth (1971) DVD9" /media/500gb/Films/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
move partition with directory & contents to another drive. EDDY1 Linux - Newbie 6 08-29-2011 03:40 AM
Using mv to move the contents of one directory into another apachedude Linux - Software 13 01-16-2009 09:57 AM
list contents of directory without listing contents baddah Linux - Newbie 2 06-12-2006 05:02 AM
Move contents of one disk to another and back again spinner_0 Slackware 4 01-20-2006 12:41 PM


All times are GMT -5. The time now is 03:13 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration