Results 1 to 10 of 23

Thread: Finding and deleting directories and files with similar names

Threaded View

  1. #1
    Join Date
    Nov 2008
    Beans
    36

    Finding and deleting directories and files with similar names

    On my computer there are about 900 redundant internet folders with the extension
    "_files". In addition there are the corresponding .htm or .html files. These files
    are not within the folders having the extension "_files". They are within the
    same directories as the folders having the extension "_files"

    The redundant folders are all over the place, in various directories. And now is the
    time to get rid of them. And the associated htm and html files.

    What would be the best way to carry out the purge with a few command-line
    operations?

    I only know how to find the folders:

    $ find ~ -name \*\\_files\* > folders.txt

    produces a text list of the redundant folders I have.

    But then what I would like to do is to

    - take the name of each folder without its _files extension
    - delete the corresponding .htm or .html file
    - delete the folder
    - and move on recursively to other directories

    So how can I capture the name of each folder and use it to
    delete first the similarly named htm/html file and then
    to delete the folder itself?

    Please can you help me? 900+ thanks if you can.
    Last edited by gefalu2008; March 17th, 2013 at 01:20 PM.

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
  •