Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default unix scripts

    Can someone tell me where I could find some good information on
    scripting or give me some guidance? I am needing to write a script to
    move certain files to a different location based on when they were
    created. For example a certain set of files that were created in July
    could be moved to a directory called July (or some directory name that
    would identify them as files created in July)created by the script.
    This would be done on the last day of the month, in this case July 31.
    If I know how to get the month of the files, I can create the
    directory and move the files into the directory. Once I know the
    script is working I would want to set it up in cron as a nightly
    process.

    Also to clean out old files, for example I have a directory called
    July or whatever and we are in October. I don't want to keep files
    more than 2 months. So I would need to check for the current month
    and check to see if there is anything older than 2 months then I want
    to remove contents of directory and directory.

    Can anyone help or tell me where I can get help?
    janet Guest

  2. Similar Questions and Discussions

    1. [ANN] Protect you Unix Shell Scripts!
      Shell scripts are very powerful tools for UNIX development. Due to the fact that they are interpreted, they are easy to develop, inspect, debug...
    2. SHAREWARE - Unix shell scripts
      Interesting comments. In general, your solutions are not portable, whereas Typhoon is portable to all modern Unices, Windows, Linux, and MacOSX. ...
    3. Portable Unix utility scripts
      The Typhoon Toolkit (http://www.raycosoft.com/rayco/products/typhoon) contains about 90 portable utility programs for text processing, file and...
    4. porting perl scripts from NT to UNIX
      "mani srinivas potnuru" <potnuru@students.uiuc.edu> wrote in message news:Pine.GSO.4.31.0307282029080.9550-100000@ux13.cso.uiuc.edu... You can't...
    5. Converting unix shell scripts to dos batch files
      Anyone know of a tool or site that converts unix (bourne) shell scripts to dos batch files (for NT/2000/XP)? Thanks, --Nikolaos
  3. #2

    Default Re: unix scripts

    janet wrote:
    >
    > Can someone tell me where I could find some good information on
    > scripting or give me some guidance? I am needing to write a script to
    > move certain files to a different location based on when they were
    > created. For example a certain set of files that were created in July
    > could be moved to a directory called July (or some directory name that
    > would identify them as files created in July)created by the script.
    > This would be done on the last day of the month, in this case July 31.
    > If I know how to get the month of the files, I can create the
    > directory and move the files into the directory. Once I know the
    > script is working I would want to set it up in cron as a nightly
    > process.
    >
    > Also to clean out old files, for example I have a directory called
    > July or whatever and we are in October. I don't want to keep files
    > more than 2 months. So I would need to check for the current month
    > and check to see if there is anything older than 2 months then I want
    > to remove contents of directory and directory.
    >
    > Can anyone help or tell me where I can get help?
    see the file "new" and the shell script archive at the ftp site below.

    --
    [url]http://ftp.opensysmon.com[/url] is a shell script archive site with an
    open source system monitoring and network monitoring software package.
    Many platforms are supplied already compiled.
    scriptOmatic Guest

  4. #3

    Default Re: unix scripts

    On Fri, 01 Aug 2003 at 19:28 GMT, janet wrote:
    > Can someone tell me where I could find some good information on
    > scripting or give me some guidance?
    - Google for shell script
    <http://www.google.com/search?q=shell+script>

    - read the comp.unix.shell newsgroup, and look at the URLs in
    some .sigs.

    - read the archives of comp.unix.shell at
    <http://groups.google.com/groups?group=comp.unix.shell>

    - read the man pages for the commands in /bin and /usr/bin.
    > I am needing to write a script to move certain files to a different
    > location based on when they were created. For example a certain set
    > of files that were created in July could be moved to a directory
    > called July (or some directory name that would identify them as
    > files created in July)created by the script. This would be done on
    > the last day of the month, in this case July 31. If I know how to
    > get the month of the files, I can create the directory and move the
    > files into the directory. Once I know the script is working I would
    > want to set it up in cron as a nightly process.
    >
    > Also to clean out old files, for example I have a directory called
    > July or whatever and we are in October. I don't want to keep files
    > more than 2 months. So I would need to check for the current month
    > and check to see if there is anything older than 2 months then I
    > want to remove contents of directory and directory.
    > Can anyone help or tell me where I can get help?
    man mv
    man find ## /mtime
    man test ## /newer
    man ls ## /long

    --
    Chris F.A. Johnson [url]http://cfaj.freeshell.org[/url]
    ================================================== =================
    My code (if any) in this post is copyright 2003, Chris F.A. Johnson
    and may be copied under the terms of the GNU General Public License
    Chris F.A. Johnson Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139