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 to count and rename
Name: hlw9 Date: June 25, 2007 at 11:36:59 Pacific OS: XP CPU/Ram: Intel core, 2GB RAM Product: Dell
Comment:
Hello, I am looking for code to help create a .bat file for Windows that does the following:
count = Number of files in a folder if count == 0, exit else FOR all files in the folder set ORIGINALFILENAME = filename of file1 rename file1 to (hardcoded) ABC.dat run sqlloader on ABC.dat rename ABC.dat to ORIGINALFILENAME.dat move ORIGINALFILENAME.dat to another folder next file
Name: hlw9 Date: June 25, 2007 at 11:53:45 Pacific
Reply:
Also, I have the command to run sqlloader. But, not the code around it.
0
Response Number 2
Name: Mechanix2Go Date: June 26, 2007 at 01:57:23 Pacific
Reply:
@echo off setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ('dir/b/a-d *.dat') do ( ren %%a ABC.dat echo do the sql on ABC.dat ren ABC.dat %%a echo move %%s d:\some\place )
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 3
Name: Mechanix2Go Date: June 26, 2007 at 04:38:11 Pacific
Reply:
CORRECTION
::== @echo off setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ('dir/b/a-d *.dat') do ( ren %%a ABC.dat echo do the sql on ABC.dat ren ABC.dat %%a echo move %%a d:\some\place ) ::==
===================================== If at first you don't succeed, you're about average.
M2
0
Response Number 4
Name: hlw9 Date: June 26, 2007 at 08:43:45 Pacific
Reply:
Thank you very, very much! That is exactly what was needed. Working fine.
Summary: Hello, I am in need of a DOS BAT file to read in the current .txt file name of a file name that starts with "CD0001" and rename it to CD0002 and tag along the date stamp of MMDDYY. I have the date sta...
Summary: Here is an intresting one using a script or bat I would like to copy and rename one dir 3300 times C:\Test\49AC194E-054B-4BDD-BC6F-77F84DB2D5BE1 (49AC194E-054B-4BDD-BC6F-77F84DB200001 to 49AC194E-05...
Summary: A question to BAT-gurus! First of all, I am not a programmer, so please don't blame my ignorance. Every morning I come to office and open my Internet Explorer to see what happened last day. I am pret...