How I can capture the last file in a directory in windows
If I have a series of file like this in a windows directory
I want to write a piece of code just to capture the last one in that directory, so I can put in a variable to do my FTP
something like
I know that the file ALWAYS start with 3526 but I don't know the other numbers again I want to capture the last file put in the directory
Note that this will take the last file alphabetically that begins with myfile. You could substitute any other filter and/or use other logic to sort the list.
Well, I am getting the following:
Here is the directory in unix
N:\orgs\Financial Aid\CSSIDOCLoad (explore)
here is my piece of code:
It is not finding the directory
I changed the real name for xxxx
Again I have files in that directory that are like 3526_419184.dat 3526_ is is a constant
but the rest like 419184 are different I want to capture the last file that was move to that directory in UpLoadFileName, so I can FTP later
1) Do you only have ftp access to the remote "Windows" machine?
Please bear in mind that the ftp is not shell and that the command set is very limited. Some ftp commands are quite similar to basic shell commands.
2) What exact version of Windows is involved? Please be very precise.
3) Is this a M$ ftp server or something else?
4) Do you you have administrator access to the Windows system to a level where you could set global environment variables? I ask this because it is notoriously difficult to get a M$ Windows system to display a DIR listing in a predicatable manner through ftp without setting a DIRCMD environment variable (see "help DIR"). Even then large directories may be displayed out of order due to underlying limitations of M$ code.
5) Your examples make it clear that the file timestamp is the only way of finding the most recent file. Your example directory when sorted by filename comes out in a different order from when sorted by file timestamp.
6) Footnote: If this is an application under development it is well worth considering including a sortable numeric timestamp in the filename (yyyymmddhhmmssfff).
I am running AIX 7.1 and currently we have samba 3.6.25 installed on the server. As it stands some AIX folders are shared that can be accessed by certain Windows users.
The problem is that since Windows 10 the guest feature no longer works so users have to manually type in their Windows login/pwd... (14 Replies)
Hi All
I am new to Unix/sloaris.
I want to copy a directory (which conatins further sub directories and files)from sloaris to my windows.I am using PuTTy for it.
please any one guide me how to do this or share with me some piece of script. It will be very regarded
Best Wishes
MIS. (3 Replies)
Hi All
I am new to Unix/sloaris.
I want to copy a directory (which conatins further sub directories and files)from sloaris to my windows.I am using PuTTy for it.
please any one guide me how to do this or share with me some piece of script. It will be very regarded
Best Wishes
MIS. (1 Reply)
Hola a todos, soy realmente nuevo programando en bash, y aśn estoy encontrando bastantes baches :o, mi pregunta es simple, supongo, alguien podria decirme si existe una manera facil de copiar un directorio de un server a otro?, sucede que en un server(server1) tengo los backup de las bases de... (7 Replies)
Hello,
If I run a program from within shell, the output is displayed in the command line terminal. Is there a way I can capture that output and choose only the very last string in it to send it to a new file?
Thank you (6 Replies)
Hi All,
I have a file that gives me new line/output every 5 minutes. I need to create a script that capture new line/output besides "IN CRON_STATUS", in this case the new output is "begin ------ cron_status.sh - -----------".
I want this script to capture the line starting from "begin ------... (0 Replies)
I am trying to capture the file name(which is not of fixed length) and put it in a variable. It is working in unix whereas when I am running the same script in Informatica it is not giving me the desired output. But when I comment the option(find the file name) then it is working fine. It can... (4 Replies)
I have a file in the following Format
Fundid: 100-BankA
AccountNumber Balance
1 200
2 300
3 400
FundId:123321-BankB
AccountNumber Balance
1 200
3 100
...........
I can have N number of funds. (1 Reply)