INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Delete scrip[t that moves files to a thrash directory

Delete scrip[t that moves files to a thrash directory

Delete scrip[t that moves files to a thrash directory

(OP)
Can anybody help me in writing a script which does the following;

- the script moves files passed in the argument to /backup/BACKUP_EL603/TRASH/
- the script accepts wildcards
- the script displays the number of files moved using the following format:

empty line
<x> files have been moved to /backup/BACKUP_EL603/TRASH/
empty line

- the script accepts the word TRASH as an argument: in this case, it deleted all files older than 2 weeks present in the TRASH directory
- the script requires at least 1 argument; if no argument is supplied the following message needs to be displayed:

empty line
Usage: <script_name> file
empty line
ex: del my_dummy_file.txt
empty line

- the script can be called from any location (without using the full path)
- possible name for the script: del

During the testing phase the behavior of the script needs to be checked also on directories and soft links.

RE: Delete scrip[t that moves files to a thrash directory

(OP)
Hi,

I am attaching what i have done. The problem that i am facing is as follows;
i have to completely eradicate the use of rm command from unix. So i have to create an ALIAS to rm and its wildcard options in UNIX in order to move files to THRASH directory and not deleting the files.

What i have already acieved:
1. delete the files with regex and tar them and keep in THRASH directory.(named after the timestamp)
2. THRASH directory cleaning every two weeks.

difficulties:
1. A file A is thrashed on day X.
2. Same file is again thrashed on the day X after some time. -> check to identify that file is already thrashed and to be thrahsed again but then generated as a seperate file.

Attached is the functionality that is already implemented.

Your help is really appreciated.

Thanks in advance

Rajan

RE: Delete scrip[t that moves files to a thrash directory

I think you mean "trash" (as in "rubbish") and not "thrash" (as in "beat repeatedly"). smile

Annihilannic
tgmlify - code syntax highlighting for your tek-tips posts

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close