Results 1 to 2 of 2

Thread: shell script to keep a tidy download folder

  1. #1
    Join Date
    Jan 2014
    Beans
    35

    shell script to keep a tidy download folder

    I have only ever written rudimentary shell scripts. I want a way to keep my main downlpad folder tidy after transmission and ktorrent move their finished downloads to it so I needn't have to keep manually moving and deleting things.

    what is the best way to accomplish this in shell?

    Premise: Download directory gets cluttered with subfolders, most of the time just having one file in it.

    · Go into ~/foo/downloads

    o

    · If dir has files of type A, B, C, D, E, F, mv types A, B, and C up to the parent directory. Then rm –Rf that folder with any files in it.

    · If dir has just one file in it, move it up to parent directory regardless of extension then remove that subdir.

    · If dir has files of type G, H, I in it, and filecount is greater than 5, mv that folder up to the parent directory.

    · If dir has files of type J, K, L in it, move the whole directory up one level

  2. #2
    Join Date
    Jun 2009
    Location
    SW Forida
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: shell script to keep a tidy download folder

    The few bash scripts I created were from copying the history file commands I used into a text file with header for bash & edit out the sudo command.
    You need to test your commands anyway.
    UEFI boot install & repair info - Regularly Updated :
    https://ubuntuforums.org/showthread.php?t=2147295
    Please use Thread Tools above first post to change to [Solved] when/if answered completely.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •