I'm in a putty session and would like to delete files from a directory which were created in the year 2009.
Please could you give me the exact command?
First off, the fact that you are using ssh doesn't really matter. What matters is the 'shell' it has presented to you and what tools you have available. I'm going to assume you're in 'Bash' and have 'find' available.
I'm also going to assume that by 'created in year 2009' you mean 'older than 2010' as it makes it easier for me... if not then look past the break!
The above will delete anything more than 567 days old (roughly back to 2009 as of the date of this post)
If you don't want stuff deleted from 2008 then you 'could' do the following:
Those numbers probably aren't right though, you can fine-tune it.
Relevant sections of man find:
I assume you are using PuTTY to connect to some computer running some distribution of Linux using SSH. Unfortunately, most Linux distributions do not record the creation date for a file. You can only find out when a file was last modified and when it was last accessed.
If you want to find all files in the current directory that were last modified in 2009, use this command:
If you want to search subdirectories too, change the
The previous two commands will only print out the file names. If you are certain you want to delete the files, add
Your best bet is to write a shell script on the target server. Plink provides no processing for stdin. See: http://stackoverflow.com/questions/603187/how-to-send-commands-to-putty