Computing.Net > Forums > Programming > BAT File Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

BAT File Help

Reply to Message Icon

Name: MaGoo
Date: February 24, 2004 at 11:18:46 Pacific
OS: XP Pro
CPU/Ram: 768
Comment:

quick help needed in DOS .

-I want to create a bat file that opens up a txt file and reads data in it (data being the names of files).
-Then check to see if the file exists in a folder.
-If exists copy it to another folder.
-If not exists make a new .txt file adding the file name that is missing to it.

eg: name.txt would contain this text in it
1003.gif
1003.jpg
1223.txt

if there is no 1003.gif in c:\folder then add the line from name.txt above to a new .txt file /n
else copy file to c:\folder2

Thanks in advance



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: February 24, 2004 at 16:33:30 Pacific
Reply:

Hi
This help.
---------------
Main.bat
@echo off
if exist new.txt del new.txt
for /f %%a in (old.txt) do call Checkit.bat %%a
---------------
Checkit.bat
@echo off
if exist \Folder\%1 (
copy Folder\%1 NewFolder\%1
) else (
echo %1 >> New.txt
)
-------------


0

Response Number 2
Name: MaGoo
Date: February 25, 2004 at 06:54:33 Pacific
Reply:

Beautiful~!!!!!!!!
i
love
you!!!!!!!!!!!!!!!


0

Response Number 3
Name: dtech10
Date: February 25, 2004 at 07:40:51 Pacific
Reply:

Hi Magoo
When's the wedding.


0

Response Number 4
Name: MaGoo
Date: February 25, 2004 at 10:25:32 Pacific
Reply:

I will have to trouble you with more problems in the future before asking your hand in marriage


0

Response Number 5
Name: dtech10
Date: February 25, 2004 at 14:05:37 Pacific
Reply:

Hi
There's always a catch.


0

Related Posts

See More



Response Number 6
Name: tImmaY
Date: February 25, 2004 at 14:15:06 Pacific
Reply:

yea.. thats the sucky part..

but is it possible to have a batch file search the computer for a certain file and then have it copy that file to a different location? i know how to copy a file, just now how to copy a file after searching/finding it.. lol. thanks


0

Response Number 7
Name: dtech10
Date: February 26, 2004 at 02:33:53 Pacific
Reply:

Hi tlmmaY
What operating system.


0

Response Number 8
Name: tImmaY
Date: February 26, 2004 at 10:25:08 Pacific
Reply:

windows xp pro


0

Response Number 9
Name: dtech10
Date: February 26, 2004 at 13:45:01 Pacific
Reply:

Hi TImmay

Call Copyfile.bat FileName StorePath
if you want permanent filename and StorePath
change %1 and %2 to that required.

---------------
rem CopyFile.bat
@echo off
if "%2"=="" (
echo Usage: CopyFile.bat Filename StorePath
exit /b
)
dir /s /b | find /i "%1" > tmp.txt
set /p FilePath=<tmp.txt
copy %FilePath% %2 > nul
if %errorlevel%==1 (
echo Filename or StorePath not Found!
) else (
echo File copied ok.
)


0

Response Number 10
Name: tImmaY
Date: February 26, 2004 at 21:08:45 Pacific
Reply:

aight tight.. lol, this may sound like a stupid question, but like whats the %2 & %1 for.. and like, how do i make it work? lol *sry*


0

Response Number 11
Name: tImmaY
Date: February 26, 2004 at 21:10:15 Pacific
Reply:

oh.. haha.. wow i'm dumb.. sorry dude, i read the entire post earlier but then i went and hung out with my chic for a while so now when i came back i kinda forgot the first part of that.. lol


0

Response Number 12
Name: dtech10
Date: February 27, 2004 at 07:00:32 Pacific
Reply:

Hi
She must be some chic.


0

Response Number 13
Name: tImmaY
Date: February 28, 2004 at 21:58:27 Pacific
Reply:

who? lol


0

Sponsored Link
Ads by Google
Reply to Message Icon

Help With Batch Programmi... Input string using C



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: BAT File Help

Bat File Help www.computing.net/answers/programming/bat-file-help-/9414.html

Bat file help www.computing.net/answers/programming/bat-file-help-/10866.html

Bat + reg = 1 bat file help!!! www.computing.net/answers/programming/bat-reg-1-bat-file-help/9468.html