This question already has an answer here:

I have a wordpress site and my current directory was wp-content

I just wanted to backup and move the current files of the wp-content/ folder to a folder called wp-content-backup20170907 and clone a new wp-content folder...

I ran the command

sudo mv /*  wp-content-backup20170907

And just realised that this moved everything - how can I undo this?

marked as duplicate by muru, user68186, Yaron, pa4080, Zanna Sep 7 '17 at 11:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Where you able to fix it? – George Udosen Sep 7 '17 at 0:28
  • Nope no commands were working and now I cannot connect to host :( – RRowan Sep 7 '17 at 0:29
  • You will need to physically access that host... and do cd ~/wp-content-backup20170907, then do (reverse) sudo mv wp-content-backup20170907/* /. Here I am assuming two things 1) that wp-content-backup20170907 is in the /home/$USER and that you wish to keep your old files else just start a fresh... – George Udosen Sep 7 '17 at 0:55

I think you wanted to do a

sudo mv ./* wp-content-backup 

you moved all files and directories in / partition to your wp-content... directory.

I guess (I never did a mv /* ) you may miss one or many bin executables (including the cp, pwd and mv command ) and also the PATH and configuration files in the shell....

I would try to

  1. Move all files and directories back to your / partition

If this doesn't work try #2

  1. Try to boot up and mount manually the partitions and move again all the files and directories back to "/" partition.
  • thanks. seems to be only these folders remaining mv: cannot move ‘/dev’ to ‘wp-content-backup20170907/dev’: Device or resource busy mv: cannot move ‘/proc’ to ‘wp-content-backup20170907/proc’: Device or resource busy mv: cannot move ‘/run’ to ‘wp-content-backup20170907/run’: Device or resource busy mv: cannot move ‘/sys’ to ‘wp-content-backup20170907/sys’: Device or resource busy mv: cannot move ‘/var’ to a subdirectory of itself, ‘wp-content-backup20170907/var’ – RRowan Sep 7 '17 at 0:26
  • no commands seem to work..i cannot connect to server now Connection to ec2xxxxxxxx.ap-southeast-2.compute.amazonaws.com closed by remote host. – RRowan Sep 7 '17 at 0:27
  • I Assume you don' t have access to the commands because now the directory dont exist ( they were moved ) . – Felipe Gutierrez Sep 7 '17 at 0:32
  • I def wanted the command sudo mv ./* wp-content-backup... just missed one dot argh.. start all over again – RRowan Sep 7 '17 at 0:33
  • Hi, this link includes a workaround for this kind of command. Ref: stackoverflow.com/questions/22444699/… Temporarily, you can do: PATH=..../backup20170907/folder/usr/bin:.../wp-content-backup20170907/bin:$PATH "now go to wp-content directory " cd wp-content-backup20170907/ mv * / – Felipe Gutierrez Sep 7 '17 at 0:47

I couldn't login to server, so booting another one up . Fortunately I have load balanced environment so am cloning other machine which is exactly same. This has worked and back to normal, thanks everyone for your suggestions - if I want still logged in possibly Felipe Gutierrez - https://stackoverflow.com/questions/22444699/ubuntu-gone-wrong-because-of-using-mv could of worked. sudo mv ./* wp-content-backup or I think i will use cp from now on not mv

Not the answer you're looking for? Browse other questions tagged or ask your own question.