Find the answer to your Linux question:
Results 1 to 5 of 5
I'm writting a simple cleanup script for my home dir and I have all the different *.extentions specified but can't figure out what to do with the rest of the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Jun 2003
    Location
    Huntington Beach, CA
    Posts
    390

    noob shell script question


    I'm writting a simple cleanup script for my home dir and I have all the different *.extentions specified but can't figure out what to do with the rest of the unnamed files. Here's what I have so far (this is my first script and I know its simple but I can't figure out the end)
    Code:
    #!/bin/bash
    #this script will clean the /home/user directory and place left over files into 
    #appropriate folders
    #
    cd /home/tyler
    mv *.txt other
    mv *.png pictures
    mv *.jpg pictures
    mv *.mp3 shared
    mv *.tar *.gz *.bz2 tarballs
    mv * other
    Thanks in advance for any help.

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    If I understand what you're trying to do correctly, you want that last line to move all the other files into other?

    In that case, just change it to *.*

    If you leave it as *, it will move all directories, too, I believe.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Linux Engineer
    Join Date
    Dec 2002
    Location
    New Zealand
    Posts
    766
    im not sure if the mv * commadn will move hidden files, but u might want to find out, coz moving hidden files/directories like .kde and .gnome will wipe ur settings

  4. #4
    Linux Engineer kriss's Avatar
    Join Date
    Jun 2003
    Posts
    1,113
    Yeah, and it won't work either, because you cannot move folder1 into folder1.

    Good luck

  5. #5
    Linux User
    Join Date
    Jun 2003
    Location
    Huntington Beach, CA
    Posts
    390
    Quote Originally Posted by sarumont
    If I understand what you're trying to do correctly, you want that last line to move all the other files into other?

    In that case, just change it to *.*

    If you leave it as *, it will move all directories, too, I believe.
    Thanks a bunch, *.* did the trick!

Posting Permissions

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