I have a text file where I need to delete the first line of data every now and then. I have a batch script that does this for me, but for some reason it adds a space to the end of each line of data.
After many loops, this grows the data file greatly (10k+ lines of data getting a space with every xcopy) and I am trying to figure out have to copy the lines of data as is without adding the extra space at the end.
Here is my script:
for /f "skip=1 delims=*" %%a in (C:\Users\User1\Documents\DataSources\AccountData.csv) do (
echo %%a >>C:\Users\User1\Documents\DataSources\newfile.txt
)
xcopy C:\Users\User1\Documents\DataSources\newfile.txt C:\Users\User\Documents\DataSources\AccountData.csv /y
del C:\Users\User1\Documents\iMacros\DataSources\newfile.txt /f /q
Any suggestions? Thanks a bunch!
Chris
The quick way is to change it to:
for /f "skip=1 delims=*" %%a in (C:\Users\User1\Documents\DataSources\AccountData.csv) do (
(echo %%a)>>C:\Users\User1\Documents\DataSources\newfile.txt
)
xcopy C:\Users\User1\Documents\DataSources\newfile.txt C:\Users\User\Documents\DataSources\AccountData.csv /y
del C:\Users\User1\Documents\iMacros\DataSources\newfile.txt /f /q