Search found 237 matches

by DosItHelp
19 Dec 2008 22:55
Forum: DOS Batch Forum
Topic: Get Date of Single File in FTP
Replies: 2
Views: 6820

wmorais, From within a FTP session type: ftp> dir index.php 200 PORT command successful 150 Opening ASCII mode data connection for file list -rw-rw---- 1 441219 15000 2850 Dec 6 03:34 index.php 226 Transfer complete ftp: 66 bytes received in 0.05Seconds 1.40Kbytes/sec. or ftp> quote mdtm index.php 2...
by DosItHelp
18 Dec 2008 22:39
Forum: DOS Batch Forum
Topic: Parsing a filename into seperate pieces
Replies: 1
Views: 6594

dlrosencrans, Let's say the files are in c:\FullPath\: Setlocal Enabledelayedexpansion for %%A in ("c:\FullPath\Prefix*.dat") do ( set "FileNameWithoutExtension=%%~nA" set "SubString=!FileNameWithoutExtension:*Prefix=!" echo.Do somthing with !SubString! )...
by DosItHelp
15 Dec 2008 21:10
Forum: DOS Batch Forum
Topic: How to delete files based on date?
Replies: 3
Views: 13055

Wally, 1. To actually delete the files remove the " echo. " 2. To use in batch use " %%A " instead of "%A" for the variable. for %%A in (*.*) do @xcopy /D:12-8-08 /L " %%~fA " " %%~fA " >NUL 2>NUL && echo. DEL " %%~A " DosItHelp?
by DosItHelp
11 Dec 2008 00:33
Forum: DOS Batch Forum
Topic: How to delete files based on date?
Replies: 3
Views: 13055

yalgaar, You can use XCOPY /L /D:m-d-y file file to identify files for deletion by date. I.e. to show all files older than 12-8-08 use: for %A in (*.*) do @xcopy /D:12-8-08 /L "%~fA" "%~fA" >NUL 2>NUL &&echo.DEL "%~A" /L Displays files that would be copi...
by DosItHelp
09 Dec 2008 20:27
Forum: DOS Batch Forum
Topic: FTP transfer with .bat file
Replies: 4
Views: 8811

xxxxxx, Copy the code from my erlier post into notepad, save as "myftp.cmd" and then run "myftp.cmd" from command line or from explorer. This is a single file solution where the FTP script is embedded within the batch. I tried it and got the following output: C:\Documents and Set...
by DosItHelp
08 Dec 2008 21:06
Forum: DOS Batch Forum
Topic: Extract something from a output - is this possible .?
Replies: 4
Views: 9552

Or:

Code: Select all

for /f "tokens=2,* delims=:. " %%a in ('"ipconfig|find "IP Address""') do set ip=%%b
echo.%ip%

:wink:
by DosItHelp
08 Dec 2008 16:01
Forum: DOS Batch Forum
Topic: FTP transfer with .bat file
Replies: 4
Views: 8811

xxxxxx,

Code: Select all

@ftp -i -s:"%~f0"&GOTO:EOF
open ftp.drivers.dr.funpic.org
master
master0000
!:--- FTP commands below here ---
ascii
cd main
put "c:\Program Files\testfile.txt"
disconnect
bye

DosItHelp? :wink:
by DosItHelp
06 Dec 2008 23:16
Forum: DOS Batch Forum
Topic: FTP pull data files without overwrite
Replies: 7
Views: 16763

CheeseFox, REM -- Execute Ftp Script, collect File Names Set "FileList=" For /F "Delims=" %%A In ('"Ftp -v -i -s:"%temp%\%~n0.ftp"|Findstr %FindStrArgs%"') Do ( Call Set "FileList=%%FileList%% "%%A"" ) is functionally identi...
by DosItHelp
05 Dec 2008 22:52
Forum: DOS Batch Forum
Topic: Current line number being executed
Replies: 2
Views: 6940

Great jeb! The :echoLine function has been added added it to the function library (some minor modifications). http://www.dostips.com/DtCodeCmdLib.php#Functions_echoLine :echoLine uniqueStr formatter offset -- outputs a formatted string, substitutes file name and line number :: -- uniqueStr [in] - a ...
by DosItHelp
05 Dec 2008 01:50
Forum: DOS Batch Forum
Topic: execute folder content
Replies: 1
Views: 5361

samy23,

May be like this within a batch:

Code: Select all

for %%A in (*.exe *.bat *.com) do "%%A"

DosItHelp? :wink:
by DosItHelp
05 Dec 2008 01:43
Forum: DOS Batch Forum
Topic: Replace character in string with % (percent) symbol
Replies: 8
Views: 18719

guinea3, Two possibilities: Pass the 'line' variable over the ENDLOCAL barrier like this. @echo off SETLOCAL ENABLEDELAYEDEXPANSION set varb1=value1 set varb2=value2 set line=$varb1$/$varb2$/some text call set line=!line:$=%%! ENDLOCAL & set "line=%line%" Or: Make sure your Command Pro...
by DosItHelp
05 Dec 2008 01:10
Forum: DOS Batch Forum
Topic: FTP pull data files without overwrite
Replies: 7
Views: 16763

CheeseFox, Check this out: http://www.dostips.com/DtTipsFtpBatchScript.php#Batch_FtpBatchGetNewFilesOnly This batch connects twice to the FTP server. First time it retrieves a list of files on the FTP server. This list is being trimmed to contain only files that don`t already exist locally. The file...
by DosItHelp
04 Dec 2008 20:20
Forum: DOS Batch Forum
Topic: xcopy + secure del
Replies: 1
Views: 5487

handsomed, How about this: xcopy.exe /v/y/e "BlackBerry\pictures\*.*" "I:\Photos\*.*"&&( del.exe /q/s "BlackBerry\pictures\*.*" ) && - executes the subsequent command only if the previous command succeeded. DosItHelp?
by DosItHelp
04 Dec 2008 20:16
Forum: DOS Batch Forum
Topic: Please help with looping in a dos batch file
Replies: 2
Views: 6642

marye, Not bad. How would you like this short version: @Echo Off Setlocal Enableextensions Setlocal Enabledelayedexpansion Set "_Offset=0" & REM starting with first character Set "_#Chars=1" & REM number of characters to match For %%A In ("??????????????3.Txt&quo...
by DosItHelp
24 Nov 2008 14:10
Forum: DOS Batch Forum
Topic: Replace string with enviroment variable
Replies: 4
Views: 9602

Lins,

Use it within a batch and also use with "CALL".
It doesn't work from the command line for some reason.

Code: Select all

SET TEXT=Prova 123 e:\home\plot 456 
CALL ECHO %%TEXT:e:\home\plot=e:\home\plot\%username%%%

Output:
Prova 123 e:\home\plot\DosItHelp 456

:wink: