This is a question regarding Xubuntu 14.04.

Very long story short, I had to use the program recoverjpeg to restore some photos that I forgot to back up after a fresh install. This resulted in 850k files getting placed into my home folder, and now it will not load. When I go to home/[username] it just spins, even after a reboot and just says "loading folder content." It has been hours. Should I just wait or is there another folder app I can load to make these files accessible? They are very important image files so I cannot risk losing them. This also means that I can't load anything in the home folder (Documents, downloads, etc) in the GUI OR the terminal.

Any advice is appreciated. Not sure what to do at this point. The files are not mine and if I can't recover them I might die. Thanks.

  • If you need more help leave a comment and I'll get back to you as soon as I can. – Rinzwind May 7 '15 at 12:20

The simplest solution would be to move the files to a different directory. That way, at least your $HOME will load. Open a terminal and run these commands:

mkdir jpeg-dir
find . -maxdepth 1 -type f -iname '*jpg' -or -iname '*jpeg' -exec mv {} jpeg-dir +

That will move all files whose name ends in jpg, jpeg, JPEG, JPG etc, to ~/jpeg-dir. That should let you load your home directory normally.

However, this means that you'll now have trouble seeing the jpeg-dir directory. So, now that you have everything in ~/jpeg-dir, you can create sub-directories, each of which holds, for example, 5000 files:

cd ~/jpeg-dir
for((i=0;i<${#jpeg[@]};i+=1500)); do 
    let c++ 
    mkdir -p dir"$c"
    mv "${jpegs[@]:$i:1500}" dir"$c"

What is happening is that the filemanager is creating a list (with ls) and that is going to take a long long time when there are lots of files.

So 1st thing to do is to clean up /home/$USER/. Go into console mode.

cd ~
mkdir tmp

This will create a tmp directory in your /home/$USER/.

Now do an ls -l | more and press enter to get an idea about what naming these files have; in general those files will have a specific extension. Let's assume that they all end in *.ext (replace to what you need in the command below). Then move all those files over to ~/tmp/ with:

 echo !(*.ext) | xargs mv -t ~/tmp/

Be careful what you type at (*.ext) and make sure you do have it include anything that should stay in /home/$USER/.

That will get you a working Desktop and /home/. If you do an ls inside ~/tmp/ you will still run into problems.

2nd part of the problem. Easiest method would be to have a script put all those files into subdirectories: this answer on SO seems to be perfect for this.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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