Linux script or tool to create consolidate filetypes?

  • Easy concept, but difficult to explain.


    My OMV box has large directory structures of several workstation backups (\Backups\). I'd like to create a separate flat directory structure of different file types (images, music, etc.) that are softlinks to the files contained within the \Backups\ directory structure, like this.



    The idea is, for example, I have a single, flat directory I can browse to to see all my pictures.


    My question is if there is some Linux utility (or Windows I suppose) that can do this, or do I have to build some script that would do this on some scheduled basis? If I have to build a script, does anyone have something that will do this, or give me a good starting point?

  • I guess you need to find files by extension?


    start scripting with this command:

    Code
    find /media/<UID>/Backups -name "*.jpg" -type f -exec echo ln -s \{\}  \/somedir\{\} \;


    Remove the echo when the output seem right.

    If you got help in the forum and want to give something back to the project click here (omv) or here (scroll down) (plugins) and write up your solution for others.

  • so here's the result:


    Code
    ln -s Backups/CloudStorage/Dropbox/_Private/Photos/Events/2015-08-28 Badass Dash/Feared Floats/2015-08-29 09.51 Badass Dash_3542.jpg ./Filetypes/ImagesBackups/CloudStorage/Dropbox/_Private/Photos/Events/2015-08-28 Badass Dash/Feared Floats/2015-08-29 09.51 Badass Dash_3542.jpg


    but I want to "collapse" all the filetypes into a single directory, and filenames have spaces in them, so I would need a result like this:

    Code
    ln -s Backups/CloudStorage/Dropbox/_Private/Photos/Events/2015-08-28\ Badass\ Dash/Feared\ Floats/2015-08-29\ 09.51\ Badass\ Dash_3542.jpg ./Filetypes/Images/2015-08-29\ 09.51\ Badass\ Dash_3542.jpg


    Is there another/better way to reference a file other than escaping the spaces? like I what I would do in windows?:
    "2015-08-29 09.51 Badass Dash_3542.jpg"


    I was following the syntax up until the curly brackets. :/


    Since I'm collapsing all the files into a single directory, what happens when there is a duplicate filename?

  • chente

    Hat das Thema geschlossen.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!