Solved CMD Add a text Filename changes constantly

November 30, 2012 at 05:14:16
Specs: Windows 7

File name changes constantly, but it always starts with Currency1 and Currency2.

I have found :echo TEST >> C:\TEST\currency1.csv
This is correct but the file name is changing constantly. If the file name is today currency1.11302012.csv for tomorrow it's currency1.01122012.csv . i need a code that's look only to the beginning of the file.


See More: CMD Add a text Filename changes constantly

Report •


#1
November 30, 2012 at 05:42:51

From your post it is not clear what you want to achieve. If your purpose is to retrieve the files whose name starts with Currency1 you can use wild characters as Currency1.????????.csv. Anyway to access a specific file you need to specify its full name.

Report •

#2
November 30, 2012 at 07:38:12

If i have 2 files.
currency1.11302012.csv
currency2.11302012.csv

i have to add each day a text on the bottom.
but each day the files are changed.

for tomorrow
currency1.12012012.csv
currency2.12012012.csv
than i have to add the same text in the files.


Report •

#3
November 30, 2012 at 08:00:49
✔ Best Answer

If each day in your folder you have just the two files to be updated, then

for %%j in (currency?.????????.csv) do @echo.text to be inserted>> %%j

The above line applies to a batch, i.e. the command is stored in a .bat file, however if issued at prompt replace %%j with %j.

Report •

Related Solutions

#4
December 3, 2012 at 04:51:54

Thank you very much. at least i have found what i wanted to make. For people in the future who needed help with this. I will past the script here. maybe i can help some one with it.

ren C:\blp\bbdl\_csv\* *?.csv

PING 127.0.0.1 -n 6

for %%j in (C:\blp\bbdl\_csv\dailycurrency1.out.????????.csv) do @echo.TEST EUR>> %%j

PING 127.0.0.1 -n 6

for %%j in (C:\blp\bbdl\_csv\dailycurrency2.out.????????.csv) do @echo.TEST >> %%j

PING 127.0.0.1 -n 6

powershell -command "& 'C:\NewScript\copy_script_PS.ps1' "


Report •


Ask Question