Sponsored Content
Top Forums Shell Programming and Scripting Files between two dates in UNIX Post 302907856 by rbatte1 on Wednesday 2nd of July 2014 06:02:00 AM
Old 07-02-2014
Quote:
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.
What you haven't said is that you are connecting with sftp and have no other access.

I have a few questions:-
  • Can you ssh connect without a password?
  • Is an ssh session allowed to create files in /tmp?
If you can, then create a script on the remote server to do this:-
  1. Identify the files
  2. Use sftp to send the files from the remote server to your local server.
If you cannont sftp to your local server, you could code the script to:-
  1. Identify the files to be transferred
  2. Bundle them up with tar to a single file with a fixed name
  3. Disconnect the ssh session (i.e. exit the remote script)
  4. Connect with sftp from your local server and get (and delete) the fixed name file
  5. Extract the contents to your desired location


If you cannot ssh you will need three main steps (in my opinion):-
  1. Connect with sftp and get a file listing, capturing it to a local file and disconnect
  2. Locally process the list to decide which files to collect
  3. Connect again with sftp getting the files you have identified.
Does this get you any further?



Robin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix dates

How can I use the date function to get the following format? Nov 18 I've tried date +%b%d but I get it in this format: Nov18 with no space. (1 Reply)
Discussion started by: ssmiths001
1 Replies

2. UNIX for Dummies Questions & Answers

Need help with Unix dates

I'm very new to Unix, so forgive me for what will probably be a very quick fix. I have the following in a ksh script. Its purpose is to return yesterday's date. The $DAY part is coming back with a '2' but I need it to return as '02'. How can I do that? date '+%b %d %Y' | { read MONTH DAY... (4 Replies)
Discussion started by: ssmiths001
4 Replies

3. UNIX for Dummies Questions & Answers

Files and dates

Hello all. I am trying to do a file listing on a particular directory by date. I need to list the files and their directories that have a timestamp between Dec-1-2006 and Jan-1-2007. Any help would be greatly appreciated. (1 Reply)
Discussion started by: mastachef
1 Replies

4. UNIX for Dummies Questions & Answers

files between any two given dates

Can any one help me in getting all the files between any two given dates.. (8 Replies)
Discussion started by: thanuman
8 Replies

5. UNIX for Dummies Questions & Answers

UNIX Dates

Hey guys. I need to manipulate the system date to move forward a day. So, if the system date was 02/14/08, I need the 'new' date to be 02/15/08 so my script will look for the date of 02/15/08. The thing is the file I will be looking for always has the date of the next day. Any ideas, ... (9 Replies)
Discussion started by: ndoggy020
9 Replies

6. Shell Programming and Scripting

Compare 2 dates in unix

I have 2 variables in my script like this $v_last_update_date1 = 08/18/2009 08:41:17 $v_last_update_date2 = 08/18/2009 08:30:17 Now I want to comapre with greater than if then go forward else error and exit out I am getting unknown test operator error Can anyone advise (1 Reply)
Discussion started by: veeru
1 Replies

7. AIX

Copy files for particular dates

Hi, I need to copy particular date files from one directory to another. For example, I have thousands of files in /home/usr From this I need to copy only particular date files (each date contains thousand number of files) to some directory of another server. Could anyone please help me... (3 Replies)
Discussion started by: teddy2882
3 Replies

8. UNIX for Advanced & Expert Users

Find all files other than first two files dates & last file date for month

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (16 Replies)
Discussion started by: Makarand Dodmis
16 Replies

9. Shell Programming and Scripting

Deleting the files between particular dates

Hi Please help me for the below task. In my home directory if I run ls -l command, it lists all the files, here I want to delete files created from January 2014 to Aug 2014...but I need to keep the files which are created after September 01 2014. Thanks Siva (3 Replies)
Discussion started by: kumar85shiv
3 Replies

10. UNIX for Dummies Questions & Answers

Need to Move files of different dates

Hi, Currently I'm moving the files based on date like below. "mv *20150901* backup_folder" - Limitation: can move only 1 day files to backup folder. I want to move the files of different dates like 20150901,02, 03, 04..... Is there any single command to do it. Thanks in advance!! (2 Replies)
Discussion started by: prakashs1218
2 Replies
sftp-server(1M) 					  System Administration Commands					   sftp-server(1M)

NAME
sftp-server - SFTP server subsystem SYNOPSIS
/usr/lib/ssh/sftp-server DESCRIPTION
sftp-server implements the server side of the SSH File Transfer Protocol as defined in the IETF draft-ietf-secsh-filexfer. sftp-server is a subsystem for sshd(1M) and must not be run directly. There are no options or config settings. To enable the sftp-server subsystem for sshd add the following to /etc/ssh/sshd_config: Subsystem sftp /usr/lib/ssh/sftp-server See sshd_config(4) for a description of the format and contents of that file. There is no relationship between the protocol used by sftp-server and the FTP protocol (RFC 959) provided by in.ftpd. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/usr/lib/sftp-server ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsshdu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
sftp(1), ssh(1), ssh-add(1), ssh-keygen(1), sshd(1M), sshd_config(4), attributes(5) To view license terms, attribution, and copyright for OpenSSH, the default path is /var/sadm/pkg/SUNWsshdr/install/copyright. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed location. AUTHOR
Markus Friedl SunOS 5.10 30 Jul 2003 sftp-server(1M)
All times are GMT -4. The time now is 10:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy