You might have to resort to copying the files (maybe using batch) instead of the copydirectory, to give you more control of the timing. This batch might get the last file to be copied in *.* order: for %%a in (source\*) do set lastfile=%%~nxa then look for that last file to appear in the target direRead more
You might have to resort to copying the files (maybe using batch) instead of the copydirectory, to give you more control of the timing. This batch might get the last file to be copied in *.* order:
for %%a in (source\*) do set lastfile=%%~nxa
then look for that last file to appear in the target directory before proceeding:
copy source\*.* dest
:a
if not exist dest\%last% goto :a
which wil hang the batch in a loop until all the files are present.
An .html file is just text. Use the normal Perl functions for reading text files. You may want to look at the HTML::Parser module to help parse this data. http://search.cpan.org/dist/HTML-Pa...
An .html file is just text. Use the normal Perl functions for reading text files. You may want to look at the HTML::Parser module to help parse this data. http://search.cpan.org/dist/HTML-Pa…
I would approach it from a three-tiered "trident":1) collect filenames (incl. filedates) form nix server, via ftp2) date-filter using vbs to create list of qualifying files a) batchfile to deliver filenames & dates to vbs b) vbs writes out qualifying files to # (ftp script)3) ftp (2nd session) uRead more
I would approach it from a three-tiered “trident”: 1) collect filenames (incl. filedates) form nix server, via ftp 2) date-filter using vbs to create list of qualifying files a) batchfile to deliver filenames & dates to vbs b) vbs writes out qualifying files to # (ftp script) 3) ftp (2nd session) using the batch-generated script to delete the files @echo off & setlocal enabledelayedexpansion #1: run ftp using script A2 to logon, change dir as needed, “dir”, quit. > logfile ( something like: ftp /s A2 > logfile) #2: set dd=%date:~4% call :xx > A1 (echo user echo passw echo cd /public :: step #2b for /f “tokens=*” %%a in (‘cscript daz.vbs ^<A1’) do echo del %%a echo quit)># :: #3: re-run ftp using the above generated script ftp /s # goto :eof :xx :: step #2a :: set skips as needed, depending on a bunch a stuff for /f “skip=15 tokens=6-9” %%a in (logfile) do ( if “%%c” equ “” goto :eof set yr=%%c if “!yr:~2,1!” equ “:” set yr= echo %%a %%b !yr!,%dd%,%%d ) ::—— end batch
‘—– begin vbs, step #2b subsection F article 4z ‘daz.vbs set cin=wscript.stdin set cout=wscript.stdout set xout=wscript.stderr dim y,x,z x=”a” do while x<>”” x=cin.readline y=split(x,”,”) fil=y(2) test=datediff(“d”,y(0),y(1)) if test> 7 then cout.writeline(fil) loop
I was going to mention you never reset $Row. Then I noticed you're only looking to see if the server is in both Excel and your list, and printing it out if so. That's logic that can be compressed into two lines.$regex = '(?i)^(' + (($manlist | ForEach-Object { [Regex]::Escape($_) }) -join "|") + ')$Read more
I was going to mention you never reset $Row.
Then I noticed you’re only looking to see if the server is in both Excel and your list, and printing it out if so. That’s logic that can be compressed into two lines.
Here's a better explanation for my post: if you're like me, you have basic login script for ftp, f/e: "login" step 1, make login script ("test") but incl. "ls" for "bare filenames" format USER username PASS pwd CD target-dir LS QUIT step 2: run ftp, using script "test" to generate list on local clieRead more
Here’s a better explanation for my post:
if you’re like me, you have basic login script for ftp, f/e: “login”
step 1, make login script (“test”) but incl. “ls” for “bare filenames” format
USER username
PASS pwd
CD target-dir
LS
QUIT
step 2: run ftp, using script “test” to generate list on local client:
ftp -n -s:test>ftp.out
step 3: get rid of junk from the list (assuming 12 lines header-junk)
@echo off & setlocal
for /f “tokens=* skip=12” %%a in (ftp.out) do (
if “%%a” equ “226 Transfer complete.” goto :eof
>>remotdir echo %%a
)
goto :eof
step 4: in batch, use “remotdir” as basis for checking fname presence on remote
@echo off & setlocal
copy /y login newftp.sct
for /f “tokens=*” %%a in (‘dir /b | findstr /v /L /g:remote’) do >> newftp.sct echo put %%a
>> newfpt.sct echo quit
echo ok, now ftp will run
pause >nul
ftp -n -s:newfpt.sct
:end-end-end
this “should” do what you want, lacking knowledge or experience with pwrshell myself.
pwrshell might let you do this in one “ftp session”, but in a pinch, this might work.
startouch1:I assume you are the administrator andsince you have to do this on 100 servers,every day, you would rather automate ?Let's build a solution for you step-by-step.1. The solaris shell command to remove allsyslog.* files isfind "/" -name "syslog.*" -print -exec rm {} \; 2. To remove syslog fRead more
startouch1:
I assume you are the administrator and since you have to do this on 100 servers, every day, you would rather automate ?
Let’s build a solution for you step-by-step.
1. The solaris shell command to remove all syslog.* files is
find "/" -name "syslog.*" -print -exec rm {} \;
2. To remove syslog files, you will need to be superuser. You can NOT login as su remotely, but you can supply the supreuser password using a HERE DOCUMENT. So, the solaris script is
4. You now want to automate for 100 solaris servers (I assume that means a lot of solaris servers).
Create a file C:/ServerList.txt as follows.
192.168.1.155\txyz\t123456\tsu_password
\t is tab. First field is IP address of the solaris server, second remote login, third remote password, fourth superuser password. Each server entry – one per line.
5. Let’s now write a biterscripting ( http://www.biterscripting.com ) script to automate this for all Solaris servers using the input from file C:/ServerList.txt.
# Script SolarisLogs.txt
var str list, serverentry, address, rlogin, rpswd, supswd, plinkcmd
set $wsep = "\t"
# Read server list.
cat "C:/ServerList.txt" > $list
# Get the first server entry.
lex "1" $list > $serverentry
# Process server entries one by one.
while ($serverentry <> "")
do
# Extract the fields.
wex -p "1" $serverentry > $address
wex -p "2" $serverentry > $rlogin
wex -p "3" $serverentry > $rpswd
wex -p "4" $serverentry > $supswd
# Compose the input.txt file.
echo "su root << "EOF"" > input.txt
echo $supswd >> input.txt
echo "EOF" >> input.txt
echo "find "/" -name "syslog.*" -print -exec rm {} \;" >> input.txt
# Compose the plink command.
set $plinkcmd="c:/Plink.exe -ssh -l "+$rlogin+" "+$address+" -pw ""+$rpswd+"" -m input.txt >> result.txt"
# Execute the plink.cmd.
system -s $plinkcmd
# Get the next server entry.
lex "1" $list > $serverentry
done
6. Save this script in file C:/Scripts/SolarisLogs.txt on your local DOS system, from where you will kick off this activity. You can now run this script manually from biterscripting with this command.
script "C:/Scripts/SolarisLogs.txt"
7. Of course, you do not want to run this manually every day. So, schedule this script to run at a time daily when the servers are least in use, using cron or task scheduler, with the following command.
That completes the solition. It was a good challenge. I have not tested it. You may need to do some trial-and-error during testing. But I hope that this, at least, provides a good starting point.
And yes, if you improve upon this solution, you should re-post it for the benefit of other over-worked Solaris administrators.
Hi, If cell A1 contains your Y or N letter, then in another cell enter this formula: =IF(A1="Y","Your cell says Yes","Your cell says No") This formula depends on the assumption that cell A1 only ever contains Y or N. You can extend the formula like this: =IF(A1="Y","Your cell says Yes",IF(A1="N", "YRead more
Hi,
If cell A1 contains your Y or N letter,
then in another cell enter this formula:
=IF(A1=”Y”,”Your cell says Yes”,”Your cell says No”)
This formula depends on the assumption that cell A1 only ever contains Y or N.
You can extend the formula like this:
=IF(A1=”Y”,”Your cell says Yes”,IF(A1=”N”, “Your cell says No”,”This looks like a maybe”))
and the formula will respond to three states – Y, N or anything else.
If you want to be sure that cell A1 contains only Y or N look at Data Validation with the List option, and you can stop anything other than Y and N being entered.
(although data validation is not case sensitive) – so the formula to use should allow both upper and lower case, like this:
=IF(OR(A1=”Y”,A1=”y”),”Your cell says Yes”,”Your cell says No”)
If you go the data validation route and need more help – just ask.
Need Help With Timing And Waiting Until Process Ends
You might have to resort to copying the files (maybe using batch) instead of the copydirectory, to give you more control of the timing. This batch might get the last file to be copied in *.* order: for %%a in (source\*) do set lastfile=%%~nxa then look for that last file to appear in the target direRead more
You might have to resort to copying the files (maybe using batch) instead of the copydirectory, to give you more control of the timing. This batch might get the last file to be copied in *.* order:
See lessfor %%a in (source\*) do set lastfile=%%~nxa
then look for that last file to appear in the target directory before proceeding:
copy source\*.* dest
:a
if not exist dest\%last% goto :a
which wil hang the batch in a loop until all the files are present.
Java.Util Cannot Find Symbol Error
Actually I figured it out, I should have typed Calendar.DATE instead of Calendar.Date.
Actually I figured it out, I should have typed Calendar.DATE instead of Calendar.Date.
See lessHow To Open .Html File In Perl
An .html file is just text. Use the normal Perl functions for reading text files. You may want to look at the HTML::Parser module to help parse this data. http://search.cpan.org/dist/HTML-Pa...
How To Create Batch File To Extract Data From Excel To Txt
:: percent.bat 2020-11-12 17:59:01.36 @echo off > OUT.TXT & setLocal enableDELAYedeXpansioN copy my.csv IN.TXT > nul for /f "tokens=1-5 delims= " %%a in (IN.TXT) do ( if %%d equ 80 echo.%%a %%b %%c %%d %%e ) >> OUT.TXT goto :eof
:: percent.bat 2020-11-12 17:59:01.36
@echo off > OUT.TXT & setLocal enableDELAYedeXpansioN
copy my.csv IN.TXT > nul
for /f “tokens=1-5 delims= ” %%a in (IN.TXT) do (
if %%d equ 80 echo.%%a %%b %%c %%d %%e
) >> OUT.TXT
goto :eof
See lessFTP Script To Delete Files Older Than 7 Days
I would approach it from a three-tiered "trident":1) collect filenames (incl. filedates) form nix server, via ftp2) date-filter using vbs to create list of qualifying files a) batchfile to deliver filenames & dates to vbs b) vbs writes out qualifying files to # (ftp script)3) ftp (2nd session) uRead more
1) collect filenames (incl. filedates) form nix server, via ftp
2) date-filter using vbs to create list of qualifying files
a) batchfile to deliver filenames & dates to vbs
b) vbs writes out qualifying files to # (ftp script)
3) ftp (2nd session) using the batch-generated script to delete the files
@echo off & setlocal enabledelayedexpansion
#1: run ftp using script A2 to logon, change dir as needed, “dir”, quit. > logfile
( something like: ftp /s A2 > logfile)
#2:
set dd=%date:~4%
call :xx > A1
(echo user
echo passw
echo cd /public
:: step #2b
for /f “tokens=*” %%a in (‘cscript daz.vbs ^<A1’) do echo del %%a
echo quit)>#
:: #3: re-run ftp using the above generated script
ftp /s #
goto :eof
:xx
:: step #2a
:: set skips as needed, depending on a bunch a stuff
for /f “skip=15 tokens=6-9” %%a in (logfile) do (
if “%%c” equ “” goto :eof
set yr=%%c
if “!yr:~2,1!” equ “:” set yr=
echo %%a %%b !yr!,%dd%,%%d
)
::—— end batch
‘—– begin vbs, step #2b subsection F article 4z
‘daz.vbs
set cin=wscript.stdin
set cout=wscript.stdout
set xout=wscript.stderr
dim y,x,z
x=”a”
do while x<>””
x=cin.readline
y=split(x,”,”)
fil=y(2)
test=datediff(“d”,y(0),y(1))
if test> 7 then cout.writeline(fil)
loop
Find An Entry In Excel File Powershell
I was going to mention you never reset $Row. Then I noticed you're only looking to see if the server is in both Excel and your list, and printing it out if so. That's logic that can be compressed into two lines.$regex = '(?i)^(' + (($manlist | ForEach-Object { [Regex]::Escape($_) }) -join "|") + ')$Read more
Then I noticed you’re only looking to see if the server is in both Excel and your list, and printing it out if so. That’s logic that can be compressed into two lines.
$regex = '(?i)^(' + (($manlist | ForEach-Object { [Regex]::Escape($_) }) -join "|") + ')$' ($ExcelWorkSheet.Range("A:A").Value() | Select-Object) -match $regexHow To Ask Questions The Smart Way
message edited by Razor2.3
Batch Script Copy Files FTP Server Check If Exists Then Skip
Here's a better explanation for my post: if you're like me, you have basic login script for ftp, f/e: "login" step 1, make login script ("test") but incl. "ls" for "bare filenames" format USER username PASS pwd CD target-dir LS QUIT step 2: run ftp, using script "test" to generate list on local clieRead more
Here’s a better explanation for my post:
See lessif you’re like me, you have basic login script for ftp, f/e: “login”
step 1, make login script (“test”) but incl. “ls” for “bare filenames” format
USER username
PASS pwd
CD target-dir
LS
QUIT
step 2: run ftp, using script “test” to generate list on local client:
ftp -n -s:test>ftp.out
step 3: get rid of junk from the list (assuming 12 lines header-junk)
@echo off & setlocal
for /f “tokens=* skip=12” %%a in (ftp.out) do (
if “%%a” equ “226 Transfer complete.” goto :eof
>>remotdir echo %%a
)
goto :eof
step 4: in batch, use “remotdir” as basis for checking fname presence on remote
@echo off & setlocal
copy /y login newftp.sct
for /f “tokens=*” %%a in (‘dir /b | findstr /v /L /g:remote’) do >> newftp.sct echo put %%a
>> newfpt.sct echo quit
echo ok, now ftp will run
pause >nul
ftp -n -s:newfpt.sct
:end-end-end
this “should” do what you want, lacking knowledge or experience with pwrshell myself.
pwrshell might let you do this in one “ftp session”, but in a pinch, this might work.
Batch File Sudo/Su Login
startouch1:I assume you are the administrator andsince you have to do this on 100 servers,every day, you would rather automate ?Let's build a solution for you step-by-step.1. The solaris shell command to remove allsyslog.* files isfind "/" -name "syslog.*" -print -exec rm {} \; 2. To remove syslog fRead more
startouch1:
I assume you are the administrator and
since you have to do this on 100 servers,
every day, you would rather automate ?
Let’s build a solution for you step-by-step.
1. The solaris shell command to remove all
syslog.* files is
find "/" -name "syslog.*" -print -exec rm {} \;2. To remove syslog files, you will need
to be superuser. You can NOT login as su
remotely, but you can supply
the supreuser password using a HERE DOCUMENT.
So, the solaris script is
su root << "EOF" su_password EOF find "/" -name "syslog.*" -print -exec rm {} \;3. If you put the above script in your DOS file
input.txt, and call the plink command as follows,
it will automate this for one server.
c:\Plink.exe -ssh -l xyz 192.168.1.155 -pw “123456” -m input.txt >> result.txt
4. You now want to automate for
100 solaris servers (I assume that means
a lot of solaris servers).
Create a file C:/ServerList.txt as follows.
\t is tab.
First field is IP address of the solaris server,
second remote login,
third remote password,
fourth superuser password.
Each server entry – one per line.
5. Let’s now write a biterscripting
( http://www.biterscripting.com )
script to automate this for all Solaris servers
using the input from file C:/ServerList.txt.
# Script SolarisLogs.txt var str list, serverentry, address, rlogin, rpswd, supswd, plinkcmd set $wsep = "\t" # Read server list. cat "C:/ServerList.txt" > $list # Get the first server entry. lex "1" $list > $serverentry # Process server entries one by one. while ($serverentry <> "") do # Extract the fields. wex -p "1" $serverentry > $address wex -p "2" $serverentry > $rlogin wex -p "3" $serverentry > $rpswd wex -p "4" $serverentry > $supswd # Compose the input.txt file. echo "su root << "EOF"" > input.txt echo $supswd >> input.txt echo "EOF" >> input.txt echo "find "/" -name "syslog.*" -print -exec rm {} \;" >> input.txt # Compose the plink command. set $plinkcmd="c:/Plink.exe -ssh -l "+$rlogin+" "+$address+" -pw ""+$rpswd+"" -m input.txt >> result.txt" # Execute the plink.cmd. system -s $plinkcmd # Get the next server entry. lex "1" $list > $serverentry done6. Save this script in file
C:/Scripts/SolarisLogs.txt on your local
DOS system, from where you will kick off
this activity. You can now run this script
manually from biterscripting with this command.
7. Of course, you do not want to
run this manually every day. So,
schedule this script to run at a time daily
when the servers are least in use,
using cron or task scheduler,
with the following command.
That completes the solition. It was a good
challenge. I have not tested it. You may need
to do some trial-and-error during testing.
But I hope that this, at least, provides a
good starting point.
And yes, if you improve upon this solution,
you should re-post it for the benefit of
other over-worked Solaris administrators.
Awk And Cksum
Solved it somewhat: $ find Commands.txt -type f -printf "%f,%s\n" | awk -F "," ' {for (i=1; i<NF; ++i) printf "%s,%d,", $1,$2; system("cksum " $1 ) }'
Solved it somewhat:
See less$ find Commands.txt -type f -printf “%f,%s\n” | awk -F “,” ‘
{for (i=1; i<NF; ++i) printf "%s,%d,", $1,$2; system("cksum " $1 ) }'
Yes/No Choice In Excel Sheet
Hi, If cell A1 contains your Y or N letter, then in another cell enter this formula: =IF(A1="Y","Your cell says Yes","Your cell says No") This formula depends on the assumption that cell A1 only ever contains Y or N. You can extend the formula like this: =IF(A1="Y","Your cell says Yes",IF(A1="N", "YRead more
Hi,
If cell A1 contains your Y or N letter,
then in another cell enter this formula:
=IF(A1=”Y”,”Your cell says Yes”,”Your cell says No”)
This formula depends on the assumption that cell A1 only ever contains Y or N.
You can extend the formula like this:
=IF(A1=”Y”,”Your cell says Yes”,IF(A1=”N”, “Your cell says No”,”This looks like a maybe”))
and the formula will respond to three states – Y, N or anything else.
If you want to be sure that cell A1 contains only Y or N look at Data Validation with the List option, and you can stop anything other than Y and N being entered.
(although data validation is not case sensitive) – so the formula to use should allow both upper and lower case, like this:
=IF(OR(A1=”Y”,A1=”y”),”Your cell says Yes”,”Your cell says No”)
If you go the data validation route and need more help – just ask.
Regards
See less