Hi Team,
I need to connect to a prod server and need to get the files which falls between two dates. I should not create ant files on that machine.
I am using korn shell.
Your help is very much appreciated.
Vinay
Hi Team,
I need to connect to a prod server and need to get the files which falls between two dates. I should not create ant files on that machine.
I am using korn shell.
Your help is very much appreciated.
Vinay
So a few questions first:-
Most importantly, What have you tried so far?
If you were to consider the problem as a manual tasks, break it down into smaller chunks and logically work out the simplest steps you can. Does that help?
Show us your efforts and thinking and we will be better placed to help you.
Robin
man find
I have gone through man pages of Find and explored a option . But I cannot use this option as I don't have permission create any files on remote server.
Here is the option which I have seen in Man pages
$touch -t yyyymmddHHMM start_date_file
$ touch -t yyyymmddHHMM end_date_file
find . -type f -newer yyymmddHHMM ! -newer yyymmddHHMM -exec
Hi I need to search in sub-directories also. I removed maxdepth option from the command but it is not working.
find . -daystart -mtime $(( -1-$(date +%j)+$(date --date '08 Oct' +%j))) ! -mtime $(( -$(date +%j)+$(date --date '10 Oct' +%j)))
I need to exclude directories in the above file list
Is it just the exclude directories part that is causing it to not work or do you get some error or other - please expand on not working.
For excluding directories try ! -type d
Thanks for your reply . I already added that exclusion in the command but the above mentioned command is not working.
---------- Post updated at 11:01 PM ---------- Previous update was at 10:57 PM ----------
here is the command which I used.
find . !-type d -daystart -mtime $(( -1-$(date +%j)+$(date --date '01 Jun' +%j))) ! -mtime $(( -$(date +%j)+$(date --date '30 Jun' +%j)))
Again if something dosn't work please show the error returned eg:
-bash: !-type: event not found
Here you are missing a space between !
and -type
sorry it is typo mistake ,I did that. Here is the command output
]find . ! -type d -daystart -mtime $(( -1-$(date +%j)+$(date --date '01 Jun' +%j))) ! -mtime $(( -$(date +%j)+$(date --date '30 Ju>
date: illegal option -- -
Usage: date [-u] [+Field Descriptors]
ksh: -1-182+: more tokens expected
---------- Post updated at 11:13 PM ---------- Previous update was at 11:12 PM ----------
More over in the example he is not considering the year. I want to consider year also
Your date command dosent support the --date option. The is a GNU extension and requires GNU date (aka linux).
You will probably have to revert to the touching of files method. You mentioned you don't have write access on the server, how about /tmp usually all users can write files there?
sftp> binary
Invalid command.
sftp> touch -t 201407020000.01 start
Invalid command.
sftp> touch -t 201407022359.59 end
Invalid command.
sftp> find . ! -type d -newer start ! -newer end -exec mget {} \;
Invalid command.
sftp> rm start end
Couldn't delete file: No such file or directory
sftp> bye
Well, none of those are man sftp ("linux") commands. While sftp does have some commands with the same name & behaviour as unix commands, it's not a remote shell.
You'd need to use something like man ssh ("linux") (and maybe man scp ("linux")) instead.
What you haven't said is that you are connecting with sftp and have no other access.
I have a few questions:-
If you can, then create a script on the remote server to do this:-
If you cannont sftp to your local server, you could code the script to:-
If you cannot ssh you will need three main steps (in my opinion):-
Does this get you any further?
Robin