Please state what Operating System and version you are running and what Shell you use.
Please expand your post substantially to include example directory listings (blotting anything confidential with X's) and a full description of the process and sample matching output.
Last edited by methyl; 01-28-2011 at 05:17 PM..
Reason: typos and idea for solution
Thanks for the reply! Am using XP os, and the bash shell!
I have got a bunch of files which are ftp'd on a box. i can list them.. out of them, i need the names of the lastest 5 updated files[Sorting by time] Assuming 5 files gets posted for a day.
otherwise, i need the script which can give me the names of the files posted the day before.[Sorting by date]
---------- Post updated at 04:37 PM ---------- Previous update was at 04:29 PM ----------
Methyl,
Hope i can explain more clearly!!
i am on one particular server [say xyz] and i can use the command "ftp" to connect to remote server to see the files on a particular directory [abc] on that server.
Now my script on my sever [xyz] should give me the files uploaded to the directory on the remote server on that particular directory [abc] the day before, assuming we are running the script today!
Now that we know that there is more than one server involved here and that "ftp" is involved, please post the exact Operating System and version of both servers and the product and version of ftp on both servers.
If Microsoft software is involved we will need Server O/S and ftp software versions to the last decimal place.
Please note that "ftp" is not Shell. Any commands I posted earlier are not necessarily relevant to "ftp" (it all depends on what environment we have here).
Please post what relevant commands you have tried (including any error messages) or other useful information.
Big question. Do you have "root" or perhaps "Administrator" access to both of the remote server and the local server? Can you make changes on both servers?
Please do post detailed examples describing input , processing and expected output.
#!/bin/sh
SERVER=example.com
DIR=some_directory
FILE="$(echo ls -t | sftp -b- $SERVER:$DIR | head -n2 | tail -n1)"
echo get "$FILE" | sftp -b- $SERVER:$DIR
The script syntax does not make a lot of sense to me though I think that I know what you are trying to do.
Please post the output from:
I suspect that this output will contain either error messages, nothing, or MSDOS directory listing detail. My guess is error messages.
Ps. It is extraordinarily difficult to get a files list in updated date order from a Microsoft ftp server. The secret is to change the environment variable DIRCMD for the account concerned (see help "dir"). This is an old MSDOS trick which still works for Windows.
" The secret is to change the environment variable DIRCMD for the account concerned (see help "dir"). This is an old MSDOS trick which still works for Windows. " Am sorry, i didnt understand this!
i use the split command to split a one terabyte backup file into 10 chunks of 100 GB each. The files are split one after the other. While the files is being split, I will like to scp the files one after the other as soon as the previous one completes, from server A to Server B. Then on server B ,... (2 Replies)
Hi,
Very good wishes to all!
Please help to provide the shell script for generating the record counts in filed wise from the .csv file
My question:
Source file:
Field1 Field2 Field3
abc 12f sLm
1234 hjd 12d
Hyd 34
Chn
My target file should generate the .csv file with the... (14 Replies)
Hii,
Could someone help me to append string to the starting of all the filenames inside a directory but it should exclude .zip files and subdirectories.
Eg.
file1: test1.log
file2: test2.log
file3 test.zip
After running the script
file1: string_test1.log
file2: string_test2.log
file3:... (4 Replies)
I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also?
I found one command which is to create gz file for the... (4 Replies)
Hi,
I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is
# echo $0
-sh
My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Hi
I have a requirement like below
I need to sort the files based on the timestamp in the file name and run them in sorted order and then archive all the files which are one day old to temp directory
My files looks like this
PGABOLTXML1D_201108121235.xml... (1 Reply)
the sorting is based on name of file,
file size
modification time stamps o f file
it should dislay the output in the following format
"." and ".." enteries should be ignored
please give some idea how to do it (1 Reply)
Hi,
Could someone please assist on a quick way of How to extract data from indexed files (ISAM files) maintained in an UNIX(AIX) server.The file data needs to be extracted in flat text file or CSV or excel format .
Usually we have programs in microfocus COBOL to extract data, but would like... (2 Replies)
Hi I am going to migrate our datawarehouse system from HP Tru 64 Unix to the Red Hat Linux.
Inside the box, it is running around 40 cron jobs; inside each cron job, it is calling other shell script files, and the shell script files may again call other shell script files or ctl files(for... (1 Reply)