Score:0

accidentally moved everything in user home directory how to undo a script

in flag

I was trying to move files from one dir to another and I missed up my home director can someone help me undo this script. everything in my home dir now put in dir called myfiles. I am on Ubuntu 20.04

mv ~/my_files/master_cs/jv/foundation_cls/ -v !("~/my_files/master_cs/jv/foundation_cls/cop_5007") ~/my_files/master_cs/jv/foundation_cls/code_snipt

Score:1
cn flag

If I am getting your question right then you can simply move back directories to home folder by opening your teriminal and doing this:

cd ~/my_files
mv * ../
Rick avatar
in flag
this did not solve the problem now everything in my_files is in /home/user and still unable to access system dir like Document and all those files/ dirs in the home/user can not find them ``` customized-script IdeaProjects Pictures snap Desktop MOK.der playground1 Templates Documents MOK.priv playground2 Vagrantfile Downloads Music play_sh Videos eclipse my_files Public 'VirtualBox VMs' eclipse-workspace online_projects shellclass ```
Rick avatar
in flag
How I can move back everything from home dir to my_files which is also now in my home dir? I think I know how to fixed if I can return back to the previous state?
Will avatar
id flag
I’m not sure why the suggested answer didn’t work. I wonder if you might find this easiest to do via the gui? Go into the folder you accidentally moved everything, make sure you can see hidden files, select everything with the mouse, right-click and cut-and-paste into the home folder. I think (someone correct me if I’m wrong) it should be near-instantaneous because nothing actually has to move if the things you’re moving are in a sub-folder.
vanadium avatar
cn flag
What is your real problem? Can't you login in your home directory anymore? If you move with a complicated command, are you not able to undo the move your self? Clarify your question: use "edit".
Rick avatar
in flag
@Will the suggested answer worked but in that panic mood I forget to do `` mv * `` so I can move everything from the files to the home directory. Now things work just fine. I just check the hidden file still in home. And thanks @vanaium
Will avatar
id flag
Thanks for posting back that you’ve sorted it - lesson for us all that doing anything on the command line in a panic is a bad idea! Well done for fixing it.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.