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 •

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 •

November 30, 2012 at 07:38:12

If i have 2 files.

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

for tomorrow
than i have to add the same text in the files.

Report •

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

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 -n 6

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

PING -n 6

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

PING -n 6

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

Report •

Ask Question