Find files not accessed on a remote server and delete - Help!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find files not accessed on a remote server and delete - Help!
# 1  
Old 07-16-2007
Find files not accessed on a remote server and delete - Help!

Hi Guys,
I am currently working on a script to find all the files that have not been accessed for the past 2 years. This, i guess has been discussed n number of times in this forum. Now, my requirement is to find all the files in the remote windows server. I have it mounted in unix.

I was thinking of doing a rsh to the remote server, find all the files and delete it. This is the command i tried -

rsh -l USER <SERVER> find <TOP LEVEL DIR> -atime <2years> -exec rm -r {} \;

I am getting a permission denied error, which i guess is because i do not have permissions to do an rsh.

My question, Will this command work as expected? Can i do an rsh to the remote windows server and remove the files there?

Are there any other methods of doing this?


Thanks,
Ashwin
# 2  
Old 07-17-2007
Can you confirm the following info...

1. Have you entered windows host in /etc/hosts file
2. and /etc/hosts.eqiv or relevent files

check the same.

It might also be port issue( rsh port).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

Error when connecting to remote server to find files with timestamp today's day

I am connecting to remote server and try to check if files with timestamp as Today's day are on the directory. Below is my code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly; Today=`date +%Y%m%d`; if ;then echo "We... (1 Reply)
Discussion started by: digioleg54
1 Replies

3. Shell Programming and Scripting

Shell script to find the GB files in /tmp directory in remote server

Hi, i need help on shell scripting. Main intention of the script is step 1: ssh to remote server Step 2: cd /tmp in remote server Step 3: in tmp i want to grep only files and directories which are in GB sizes All the servers list file is - tmpsrv.txt vi tmpsrv.txt ... (17 Replies)
Discussion started by: kumar85shiv
17 Replies

4. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

5. Shell Programming and Scripting

Log to find users who accessed server before

Hi, please provide the steps/commands to find out the user id list who accessed server before i logon same server. Thank you very much ffor all your support. (2 Replies)
Discussion started by: sridhardwh
2 Replies

6. Shell Programming and Scripting

Find and delete files and folders which are n days older from one unix server to another unix server

Hi All, Let me know how can i find and delete files from one unix server to another unix server which are 'N' days older. Please note that I need to delete files on remote unix server.So, probably i will need to use sftp, but question is how can i identify files and folders which are 'N'... (2 Replies)
Discussion started by: sachinkl
2 Replies

7. UNIX for Dummies Questions & Answers

Long listing of files using find command on remote server via SSH

Hi , I am trying to find some files on a remote machine using the find command. >ssh -q atukuri@remotehostname find /home/atukuri/ -name abc.txt /home/atukuri/abc.txt The above command works fine and lists the file, but if I want to do a long listing of files (ls -l) its not working . ... (2 Replies)
Discussion started by: atukuri
2 Replies

8. Shell Programming and Scripting

delete oldest images from remote server

Would someone please give me a script that will remove all but the newest jpg image from my server. i am uploading a new image every 10 seconds form a live web cam Also i do not know who to make a shell script work i am new to all this so i need all the help you could give Thank You very much (1 Reply)
Discussion started by: Destined
1 Replies

9. AIX

Get the list, filter and delete the files on remote server

Hi, I need to login to a remote server. Go to a particular path. Get the lists of files on that path.There may be n number of files. I need to delete only those files from above created list which are 7 days older. I have achieved above using ftp protocol, but now the constraint has... (0 Replies)
Discussion started by: mail_amitnagpal
0 Replies

10. UNIX for Advanced & Expert Users

delete files on a remote server

Hi Guys, I am currently working on a script to find all the files that have not been accessed for the past 2 years. This, i guess has been discussed n number of times in this forum. Now, my requirement is to find all the files in the remote windows server. I have it mounted in unix. I... (1 Reply)
Discussion started by: bond_bhai
1 Replies
Login or Register to Ask a Question