1

I was installing osclass on AWS and through the process of moving/renaming the file called ' to the website I came across an error "

[ec2-user@ip-172-31-17-158 html]$ mv . mywebsite
mv: cannot move ‘.’ to ‘mywebsite’: Device or resource busy

Can someone help me ?

2 Answers 2

2

You can't mv the current directory.

Instead, do this :

cd .. # parent dir
mv dirname /path/to/mywebsite
3
  • Note to the OP: .is shorthand for the current active directory Oct 16, 2016 at 16:02
  • The correct terminology is "present working directory", hence the pwd command.
    – MarioDS
    Oct 16, 2016 at 18:30
  • This should be changed in Linux. Flying on a directory to different locations ought to be allowed.
    – user147505
    Oct 17, 2016 at 1:05
-1

For fast usage, you may use:

mv * mywebsite

This will cause an error saying it cannot move mywebsite inside mywebsite, but will move all other files, except hidden files.

If you're using bash you can fix it by enable the extglob via:

shopt -s extglob

then you can use:

mv !(mywebsite) mywebsite

it will move all files except website to website folder.

If you want a more complicated and elegant solution (and also works with hidden files), you may use:

find . -mindepth 1 -maxdepth 1 -not -name mywebsite -exec mv {} mywebsite \;

A last solution can be a loop:

for file in $(ls -1 | grep -v mywebsite); do mv $file mywebsite; done
4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .