• Missing directories and movies

    Moved all my movies to one external USB hard drive so I could catalog them. But since there are many movies, I decided to create directories like this:

    • movie_a
    • movie_b

    This was done on the terminal mkdir movie_a, etc. It’s easy to have movies like this, I think. When I want to find a movie, I know the title.
    Then I moved “mv -v a* movie_a/” and a few more into those directories. After creating movies_a, b, c, d, e and f, I opened nautilus (files) to see how more movies I had and I could not found movie_a or the others.
    This was after I moved movies and It showed that files were “renamed” (moved) into the directories.
    So let me draw the picture of it:

    mkdir movie_a
    mkdir movie_b
    mv -v a* movie_a/

    open nautilus -> look for movie_a -> missing directories

    At the time I had another USB drive full formatting because I want to move it to another computer, so I guessed it was a sync issue, maybe too much going on the USB line. I did sync and rebooted.

    Directories were still missing and I don’t know where are my a* movies now. I created “mkdir movie_a” and it created a new movie_a.

    What da hell? I know it’s a bit strange situation but I cannot reproduce it now, because I created another directories, moved other movies and they are now there.

    Has anyone experienced any missing stuff?

  • @casquinhasjr
    If you didn’t accidentally do the moving on the wrong USB drive or some other similar error, that kind of problem should not happen.
    Are you sure you checked the right directory root with nautilus?

    Syncing is very important when moving large files like videos.
    But your commands show that you moved files within the same partition, so it should have been a very fast operation anyway.

  • @manuel thanks for your words but I found it. I moved into movie_v and created a few, including movie_a inside movie_v

    So it was my mistake. Damn. I hate being wrong.

    What did I do to find it, since history command did not help at all. It only show a few command.

    Well , first since I don’t have a clue where are my files, let me grab them all.

    find . > seagate.txt
    sort < seagate.txt > s.txt

    Now in s.txt I have all files sorted.

    cat s.txt | grep -i "/a"

    And in a few lines I see this:


    Now let me tell you how stupid I did felt after that. Very.

  • @casquinhasjr
    Well, we all make mistakes sometimes, don’t worry too much.
    Might also think of it as one of many learning sessions, since if we don’t do mistakes, we don’t learn either. :)

    And as you saw, the find command is very useful in many cases.

  • Oh another important lesson after this. If I had a complete history of commands, like a log of all my terminal commands and everything I did, I could find it, going back in time. I don’t need a log like the mainframe zOS log, but a simple log.

    So, two ways to keep a record of all the stuff you do on the terminal, as I prefer to use the terminal than other place for file management.

    The script command let you save all the stuff on the terminal and can be used like this:

    **[email protected] ~]$ script today.txt
    Script started, file is today.txt
    [[email protected] ~]$ pwd
    [[email protected] ~]$ date
    Tue Mar 27 16:04:58 WEST 2018
    [[email protected] ~]$ exit
    Script done, file is today.txt
    [[email protected] ~]$ cat today.txt
    Script started on 2018-03-27 16:04:48+0100
    [[email protected] ~]$ pwd
    [[email protected] ~]$ date
    Tue Mar 27 16:04:58 WEST 2018
    [[email protected] ~]$ exit

    Script done on 2018-03-27 16:05:00+0100
    [[email protected] ~]$**

    This way you can save to a file all the terminal commands. You can automate this to record the files with year and month and day, etc. Pretty nice, fast and no need for external programs.

    Connect yourself to ssh via putty, and choose the log on Session->Logging properties:

    Log file name: /home/lino/Desktop/&H_putty&Y&M&D.txt

    This way, I will have logs by day for all the terminal commands. Don’t forget to create a session so your settings are recorded and you simple open putty, load e voilá, ready.

  • Great that your files were not missing! :)

    How about a small script for moving the files? Like

    for letter in {a..z}
      mkdir -p movie_$letter
      for file in $letter*.mp4 $letter*.mpg   # all videos (with correct endings) here!
        test -f $file && mv -v $file movie_$letter/

    Note that I didn’t test this, so it may contain bugs.
    That should move video files a*.<ending> to movie_a and so on.
    But probably you don’t need this anymore…

  • @manuel lol I don’t need this anymore… now! But thank you for the script.

    I’m testing the script. Any changes I’ll report back to you. Since I did not move a lot of movies and directories, I did not had the need for a script but I still have more organization to do. So, let’s test this out!

  • @casquinhasjr
    That script stuff is really a nice thing to have, thanks! Wasn’t aware of that, I thought only the history of commands were available.

  • @manuel I’m saying thank you for the script with the perfect album to build and test scripts:

    Causa Sui

    Enjoy all their other albums too.

  • @casquinhasjr
    Listening to the band as we speak! Nice! :)

  • @manuel said in Missing directories and movies:

    for letter in {a…z}
    mkdir -p movie_$letter
    for file in $letter*.mp4 $letter*.mpg # all videos (with correct endings) here!
    test -f $file && mv -v $file movie_$letter/

    Just found a great bash debugger http://bashdb.sourceforge.net/

    And pretty easy to use. Do you use any other one?

  • @casquinhasjr
    No. And to be honest, I really haven’t used it, I’m too accustomed to using old school “print debugging”… ;)

    But agreed, it could be a very useful tool. In general, debuggers are often very useful for finding these annoyingly difficult problems in (especially large) programs.

    I have used shellcheck to analyze scripts.

    By the way, bashdb is in AUR too.

  • As bashdb has a similar interface to gdb, it may have a good compatibility with the emacs editor. Haven’t tested it though.

missing54 directories2 movies2 Posts 13Views 475
Log in to reply
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.