LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Moving Files (https://www.linuxquestions.org/questions/linux-newbie-8/moving-files-93470/)

jhotchkiss 09-16-2003 01:22 PM

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

smazzux 09-16-2003 01:37 PM

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

jhotchkiss 09-16-2003 01:46 PM

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

Gates1026 09-16-2003 02:42 PM

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 ;)

smazzux 09-16-2003 03:20 PM

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

jhotchkiss 09-16-2003 03:41 PM

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


All times are GMT -5. The time now is 08:52 AM.