Find the answer to your Linux question:
Results 1 to 2 of 2
Hello friends, When I download a web site, there are lots of directories and subdirectories. I want to search and find files which is .jpg and move up to them ...
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    28

    Directory moveup and clean

    Hello friends,

    When I download a web site, there are lots of directories and subdirectories.
    I want to search and find files which is .jpg and move up to them main directory. And then clean everything, except from .jpg files.
    in bash script how can i do?

  2. #2
    Just Joined!
    Join Date
    Dec 2008
    Posts
    35
    I'm not that sure about *Nix terminal commands but I'm wondering, would "locate" work like this?
    So that may be...
    Code:
    locate ~/<dir-to-website>/*.jpg
    if exist *.jpg
    mv *jpg ~/<dir-to-website>/*jpg
    ...or something like that?

    If not, then I reckon it would be a similar case of doing the above a little differently by cd'ing to each folder then cp (or) mv *.jpg ~/<dir-to-website>/*.jpg or something.

    But note that if you do this, when you load the webpages in your web browser, the webpages will not render properly because the associated jpeg files do not exist where the HTML claims they are. i.e. index.html requires a picture cat.jpg to be loaded as the background image, since its <img src ="/website/image-dir/cat.jpg" does not exist, it will not be loaded and you have have, more or less, a corrupted web page. Unless you go through each web page's HTML and change it to fit your liking.

Posting Permissions

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