0

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?

Zanna
  • 69,223
  • 56
  • 216
  • 327
RRowan
  • 133
  • 7
  • Where you able to fix it? – George Udosen Sep 07 '17 at 00:28
  • Nope no commands were working and now I cannot connect to host :( – RRowan Sep 07 '17 at 00: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 07 '17 at 00:55

2 Answers2

0

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 07 '17 at 00: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 07 '17 at 00:27
  • I Assume you don' t have access to the commands because now the directory dont exist ( they were moved ) . – Felipe Gutierrez Sep 07 '17 at 00:32
  • I def wanted the command sudo mv ./* wp-content-backup... just missed one dot argh.. start all over again – RRowan Sep 07 '17 at 00:33
  • Hi, this link includes a workaround for this kind of command. Ref: https://stackoverflow.com/questions/22444699/ubuntu-gone-wrong-because-of-using-mv 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 07 '17 at 00:47
  • If previous steps don't work, Try using the MV command but this time using the "new path" Ex. # ./backup20170907/folder/bin/mv backup20170907/* / – Felipe Gutierrez Sep 07 '17 at 00:53
  • Thanks everyone, I couldn't login to server, so booting another one up . Fortunately I have load balanced environment so am cloning the machine which is exactly same. Will update shortly. ta – RRowan Sep 07 '17 at 01:38
0

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

RRowan
  • 133
  • 7