LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-16-2003, 02:22 PM   #1
jhotchkiss
LQ Newbie
 
Registered: Sep 2003
Distribution: RedHat 9
Posts: 17

Rep: Reputation: 0
Question Moving Files


I know that this question is lame, but I can't figure out what I am doing wrong...

I have a bunch of directories that contain images and other directories in the following path: /data/images/mspl06img

I want to move the files and directories in /mspl06img one directory down the path to: /data/images

I thought the following would accomplish this (logged in as root):
#mv -v /data/images/mspl06img /data/images

however I receive the following error:
mv: can't stat source /data/images/mspl06img

Can someone please tell me what I am doing wrong?

Thanks!
Jason Hotchkiss
Linux Newbee

Last edited by jhotchkiss; 09-16-2003 at 02:37 PM.
 
Old 09-16-2003, 02:37 PM   #2
smazzux
LQ Newbie
 
Registered: Sep 2003
Location: Italy
Distribution: Slackware 9.1, RedHat 6.2, RedHat 8.0, Fedora Core 1, FreeBSD 5.0, Coyote Linux
Posts: 15

Rep: Reputation: 0
try this

#mv -v /data/images/mspl06img/* /data/images

with the above command you would move the directory in its actual position.. this would result in nothing at all

this moves all the files (and dirs) which are inside taht folder (mspl06img) up one level. so the folder mspl06img will then be empty and the files will be in /data/images

smazzux
 
Old 09-16-2003, 02:46 PM   #3
jhotchkiss
LQ Newbie
 
Registered: Sep 2003
Distribution: RedHat 9
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks!

Thanks for your reply smazzux:

I tried what you suggested, and at first it didn't work. So I started to dig a bit deeper...

The following command worked after I learned that /image did not contain /mspl06img.

#mv -v /data/mspl06img/* /data/images

The * is what I needed the most...

This is what you get when you have a windows admin trying to learn Linux

Thanks again - mission accomplished!

-Jason Hotchkiss
 
Old 09-16-2003, 03:42 PM   #4
Gates1026
Member
 
Registered: Sep 2003
Location: Iowa
Distribution: Slackware 9.1
Posts: 155

Rep: Reputation: 30
I would reccomend that you do a copy, in case you were to botch something and lost your data......after you do a copy, do a rm -f

#cp -R /data/images/mspl06img ..

note: the -R just is set in case there are any directories in there, this would make the appropriate directories and then put the correct files in them.

This should move them 1 directory down, then you can cd mspl06img and do rm -f * if it works out ok........check first
 
Old 09-16-2003, 04:20 PM   #5
smazzux
LQ Newbie
 
Registered: Sep 2003
Location: Italy
Distribution: Slackware 9.1, RedHat 6.2, RedHat 8.0, Fedora Core 1, FreeBSD 5.0, Coyote Linux
Posts: 15

Rep: Reputation: 0
good work!!

yeah, gates' right..
but pay a big attention to "rm -f" and even more to "rm -fr"
in the first case you are not asked if you want to delete the files in the current directory..
in the second your not asked to delete files even in subirectories!!!
but it's very useful when you have to delete a dir.. just double check the name

a tip:

never do rm -f *

but do

rm -fr <dirname>

so you are going to delete that dir.. maybe it's useful to make use of the TAB, which automagically completes your typing...

just practise a bit!!

bye
 
Old 09-16-2003, 04:41 PM   #6
jhotchkiss
LQ Newbie
 
Registered: Sep 2003
Distribution: RedHat 9
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks Again...

Im working with non volital data, so I am not too worried about messing up beyond recovery.

However, all the information you guys provided was very helpful and I do appreciate your taking the time to help me out.

Thanks Again!
Jason Hotchkiss
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving files Pyrophorus Slackware 5 11-09-2005 11:47 AM
Moving files UmneyDurak Fedora 4 08-28-2005 06:52 PM
moving files pantera Programming 2 08-23-2005 06:58 AM
Moving Files arockia Linare 3 09-08-2004 09:14 AM
moving files from one box to another AZDAVE Linux - General 6 08-14-2003 10:22 AM


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