quick linux command question

Page 1 of 1

8 Replies - 819 Views - Last Post: 17 September 2009 - 11:40 AM

#1 realNoName   User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 343
  • Joined: 04-December 06

quick linux command question

Posted 15 September 2009 - 05:44 PM

ok i just have a quick linux command question, i have a drive mounted at /mnt/raid that has a lot of folders and i want to move them all to /mnt/raid/media so would this command work? am not that good at linux and i just wanted to check that this will work because i dont want to mess anything up :P

mv -r /mnt/raid /mnt/raid/media

Is This A Good Question/Topic? 0
  • +

Replies To: quick linux command question

#2 Guest_Neumann*


Reputation:

Re: quick linux command question

Posted 15 September 2009 - 06:01 PM

/mnt/raid points to the root directory of the mounted partition. The previous directory structure of /mnt/raid is now invisible to the OS. In addition, you're trying to copy the directory onto itself - it doesn't make sense and won't work anyway.

This post has been edited by Neumann: 15 September 2009 - 06:02 PM

Was This Post Helpful? 0

#3 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: quick linux command question

Posted 15 September 2009 - 06:07 PM

To further show what Neumann has just explained, you can check the output of df to view all of your mount-points along with their block names.
Was This Post Helpful? 0
  • +
  • -

#4 realNoName   User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 343
  • Joined: 04-December 06

Re: quick linux command question

Posted 15 September 2009 - 06:26 PM

oops i little type-o maybe i should had put -> mv -r /mnt/raid/* /mnt/riad/media/
would that work?

View PostNeumann, on 15 Sep, 2009 - 05:01 PM, said:

/mnt/raid points to the root directory of the mounted partition. The previous directory structure of /mnt/raid is now invisible to the OS. In addition, you're trying to copy the directory onto itself - it doesn't make sense and won't work anyway.


i know but i want to move all 100 folders that are in /mnt/raid into /mnt/raid/media, so is there an easy way of that that?
Was This Post Helpful? 0
  • +
  • -

#5 Guest_Neumann*


Reputation:

Re: quick linux command question

Posted 15 September 2009 - 06:36 PM

View PostrealNoName, on 15 Sep, 2009 - 05:26 PM, said:

i know but i want to move all 100 folders that are in /mnt/raid into /mnt/raid/media, so is there an easy way of that that?

/mnt/raid/media is part of /mnt/raid, so you're trying to copy /mnt/raid/media onto itself. Again, this makes absolutely no sense and will not work. Simple as that.
Was This Post Helpful? 0

#6 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: quick linux command question

Posted 15 September 2009 - 06:36 PM

as long as media already exists. I would drop the dash r.

mv /mnt/raid/* /mnt/raid/media/

That will move all files & directories. So if you have any sub directories, it will move those too.

/mnt/raid/dir1/dir2/file

will be moved to

/mnt/raid/media/dir/dir2/file

Everything.
Was This Post Helpful? 0
  • +
  • -

#7 realNoName   User is offline

  • D.I.C Regular

Reputation: 7
  • View blog
  • Posts: 343
  • Joined: 04-December 06

Re: quick linux command question

Posted 15 September 2009 - 07:07 PM

ok thanks, i wanted to double check just because when it gets to the media folder i didn't know what it would do because that 1 folder isn't moving just every thing else if getting moved into it
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: quick linux command question

Posted 15 September 2009 - 07:11 PM

When it tries to move media it will complain about moving a directory into itself.
Was This Post Helpful? 0
  • +
  • -

#9 olibenu   User is offline

  • D.I.C Addict
  • member icon

Reputation: 45
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: quick linux command question

Posted 17 September 2009 - 11:40 AM

maybe u want to unmount it and mount it in the new folder
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1