Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Retrieve the Latest file in a folder using SFTP Post 303028836 by jgt on Tuesday 15th of January 2019 09:35:45 PM
Old 01-15-2019
This should give you a good starting point.
Code:
jack@veritron ~ $ f=zions.s2550nai.jan0819
jack@veritron ~ $ d=$(echo $f|cut -f3 -d".")
jack@veritron ~ $ echo $d
jan0819
jack@veritron ~ $ m=$(echo $d|cut -c1-3)
jack@veritron ~ $ echo $m
jan
jack@veritron ~ $ day=$(echo $d|cut -c4-5)
jack@veritron ~ $ echo $day
08


jack@veritron ~ $ y=$(echo $d|cut -c6-7)
jack@veritron ~ $ echo $y
19
jack@veritron ~ $ date +"%s" --date="$m $day 20$y"
1546923600

Do this for each file and select the one that returns the highest value.

Last edited by jgt; 01-15-2019 at 10:41 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copy the latest file from a folder

Hi, I have a problem. I have some text files in a folder. The names can be like: emp_20080307053015.dat emp_20080306053015.dat emp_20080305053015.dat emp_20080304053015.dat The date format appended is like yyyymmdd and timestamp. What i need is i have to copy the latest file every... (3 Replies)
Discussion started by: Aswarth
3 Replies

2. Shell Programming and Scripting

Copying latest file into a folder

Hello all, this is my first post while i am trying to understand unix. I would basically like to know if i can do this: Lets say i have a folderA and folderB And i save something in folderA Can i make a script that checks folderA latest file, then compares it with the date of latest file in... (16 Replies)
Discussion started by: takissd
16 Replies

3. Shell Programming and Scripting

Latest file through SFTP

Hi, I want to download the latest file published on remote server using SFTP connection. The job will run at every 15 min hence should download only the latest file. The fileName will be like ABC_DDHHMISS.txt (DD- day, HH-hour, MI - Min, SS-Sec). So there will be files with same date for... (23 Replies)
Discussion started by: ssachins
23 Replies

4. Shell Programming and Scripting

SFTP latest file from Windows server to Unix host

Hi All, I am SFTP ing file from Windows server (Sydney) to Unix host in London (both servers are on different timezones). It appears the upstream (Windows server team) does not do a file housekeeping activity and henceforth there are multiple files i.e. each week the script is scheduled to run... (1 Reply)
Discussion started by: vigdmab
1 Replies

5. Shell Programming and Scripting

Need to copy latest file using SFTP

Hi All, In my unix server, I have the following files: h1.txt h2.txt h3.txt and through SFTP i need to copy only the latest file to another unix server. Can you please let me know what command i need to use. Thanks in Advance, (2 Replies)
Discussion started by: HemaV
2 Replies

6. UNIX for Dummies Questions & Answers

Copy the latest (last file) in given folder

#!/bin/bash for i in {1..1536..1} do #find /home/test/Desktop/up111/workplace/Malware/$i/logs for a in /home/test/Desktop/up111/workplace/Malware/$i/logs/* do #max=a for b in /home/test/Desktop/up111/workplace/Malware/$i/logs/* do ... (4 Replies)
Discussion started by: upvan111
4 Replies

7. UNIX and Linux Applications

Need to copy the latest file from Unix server to Shared folder

Hi All, One job in unix server will generate .csv files daily. I need to copy the latest of these .csv file from the unix server to the shared drive/folder in windows through unix script. My shared folder will look something like W:\some folder(for example). Could any one of you please help... (3 Replies)
Discussion started by: jaya@123
3 Replies

8. UNIX for Dummies Questions & Answers

Find the latest file on remote sftp

Hi All, I need your help in finding the latest files in remote sftp and get those files to local server and process them. Please let me know I appreciate your valuable inputs. Thanks raj (7 Replies)
Discussion started by: rajeevm
7 Replies

9. Shell Programming and Scripting

How to retrieve the latest files from the directory.?

hi, i have some file in a directory say p1.txt.201305051200.lst p1.txt.201305051300.lst p1.txt.201306051200.lst p1.txt.201306051300.lst p2.txt.201306051200.lst p2.txt.201306051300.lst i am using p* pattern to retrieve these file ls -1 p* the files in red color are the latest... (7 Replies)
Discussion started by: Little
7 Replies

10. Shell Programming and Scripting

Need to automate sftp and always get the latest file

hi guys the script is working but i need to change the file that i want to get to the latest.. i will use this as cron so i can get the latest sftp file evryday. pls help.. set user "big_user" set IP "XX.XX.XX" set dir "/export/home/oracle/REF/INPUT" spawn sftp $user@$IP expect sftp> ... (7 Replies)
Discussion started by: JONATHAN0919
7 Replies
JACK.PLUMBING(1)														  JACK.PLUMBING(1)

NAME
jack.plumbing - JACK Plumbing Daemon SYNOPSIS
jack.plumbing [options] [rule-files] OPTIONS
-d : Do not operate as a daemon. -o : Do not load ordinary rule files. -q : Quiet operation. -u : Set the time, in micro-seconds, that must elapse after a connection notification to indicate the end of a notification set (default=30000). This is an optimization switch. DESCRIPTION
jack.plumbing maintains a set of port connection rules and manages these as clients register ports with JACK. Port names are implicitly bounded regular expressions and support sub-expression patterns. There are four rules: connect, disconnect, also-connect and connect-exclusive. (connect "SuperCollider:out_(.*)" "system:playback_1") This connect rule ensures that whenever scsynth(1) is running any output ports it registers are connected to appropriate ALSA playback ports. The connect rule only makes a connection if none already exist. (also-connect "system:playback_1" "jack.udp-[0-9]*:in_1") This also-connect rule ensures that when jack.udp(1) is running in send mode all signals that are ordinarily sent to the local audio interface will also be sent to the network destination. The also-connect aliasing applies to both the left and right hand side of connect rules. (connect-exclusive "SuperCollider:out_(.*)" "ardour:sc3_in_1/in 1") This connect-exclusive rule ensures that if SuperCollider and an ardour(1) session with appropriate tracks are both running that SuperCollider gets connected to ardour and disconnected from everything else. This type of connection daemon has the following advantages over both environment variables and command line arguments: o it does not require any client connection support or logic at all o it provides a uniform user interface to all clients o it has a somewhat declarative style This type of daemon is very lightweight and non-intrusive: it requires no arguments, it runs from an unprivileged thread, if the rule set is empty it is a no-op, it does not write any files, it does not require any modification to clients or to how clients are started. When a set of port registrations is made it checks the modification time of the rule set files, /etc/jack.plumbing and ~/.jack.plumbing, and any files specified by the user, rereads the rule set if it has been updated, then makes the JACK graph obey the rules. Any lines beginning with a semi-colon are ignored. The rule set is sorted, disconnect rules are applied first, then connect rules, then connect-exclusive rules. FILES
o /etc/jack.plumbing o ~/.jack.plumbing AUTHOR
Written by Rohan Drape http://slavepianos.org/rd/ SEE ALSO
jackd(1) AUTHOR
Rohan Drape <rd@slavepianos.org> Author. 01/10/2012 JACK.PLUMBING(1)
All times are GMT -4. The time now is 09:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy