GithubHelp home page GithubHelp logo

anhsirk0 / file-arranger Goto Github PK

View Code? Open in Web Editor NEW
59.0 59.0 3.0 2.2 MB

Simple & capable Directory arranger/cleaner

License: GNU General Public License v3.0

Perl 92.37% Shell 7.63%
arranger bsd command-line command-line-tool linux perl terminal

file-arranger's Introduction

file-arranger's People

Contributors

anhsirk0 avatar bad3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

file-arranger's Issues

Moving compressed files based on their uncompressed type

It would be useful to be able to arrange compressed files based on their uncompressed type. I see the following use cases:

  1. The compressed file decompresses to a single file. The uncompressed file extension is in the name of the compressed file.
    • E.g. my_file.csv.gz decompresses to my_file.csv and so is sent to Documents. Simultaneously, my_script.py.zip decompresses to my_script.py so is sent to Other.
    • In this case the file type can be inferred from the name by stripping off compression type suffix.
  2. The compressed file decompresses to a single file. The uncompressed file extension is not visible in the compressed file name.
    • E.g. my_file.gz decompresses to my_file.csv
    • Requires looking inside the compressed file.
  3. The compressed file decompresses to multiple files. The uncompressed files all have the same type and the uncompressed file extension is in the compressed file name. E.g. all_my_files.csv.gz decompresses to file1.csv, file2.csv etc.
    • I doubt this would be common, but it could be treated the same as case 1. We wouldn't be able to differentiate between cases 1 and 3 without looking inside the compressed file.
  4. The compressed file decompresses to multiple files, which have different types. E.g. all_my_files.gz decompresses to file1.txt, file2.csv etc.
    • Requires looking inside the compressed file. It is possible the decompressed files would not belong to the same category, so we would be unable to arrange the compressed file anyway.

I propose a new flag called -arrangeCompressed which will support cases 1 and 3.

The logical flow would be: Does the file have an extension indicating that it is a compressed file?

  • No:
    • Ignore this file and do not move it.
  • Yes:
    • Strip off the compressed file extension.
    • Arrange the file based on what is left.

Caveats:

  • If all_my_files.csv.gz contains files of multiple types, they will all be sorted based on a .csv extension. I think this is still sensible behaviour.

Another option would be to add two flags: -arrangeCompressed and -arrangeCompressedOnly. -arrangeCompressedOnly behaves as I have described above. -arrangeCompressed behaves as above except that files that are not compressed are arranged rather than ignored.

I can submit a PR for either of these options. Keen to hear your thoughts.

Best,
Michael

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.