1.

Solve : kCopying Batch files, and Renaming without the Extension...?

Answer»

Hi, I recently began making some batches to HELP me in my work, and I'm having a problem since I want to remove the file extension from my copied file's new name:

@echo off
cd C:\teste2
set Day=%Date:~0,2%
set MTH=%Date:~3,2%
set Yr=%Date:~6,4%
set Hr=%Time:~0,2%
set Min=%Time:~3,2%
set Sec=%Time:~6,2%

copy *.pdf "C:\teste\*_%Day%%Mth%%Yr%_%Hr%%Min%%Sec%.pdf"

It simply copies all the pdf files from the folder " C:\teste2" and renames it with the CURRENT Date and Time, but it also comes with the extension, example: "renamedfile.pdf_03092008_131200.pdf"
and I dont want the the "pdf" in the middle of the name.Code: [Select]@echo off
cd C:\teste2
set Day=%Date:~0,2%
set Mth=%Date:~3,2%
set Yr=%Date:~6,4%
set Hr=%Time:~0,2%
set Min=%Time:~3,2%
set Sec=%Time:~6,2%
for %%V in (*.pdf) do copy "%%V" "%%~nV_%Day%%Mth%%Yr%_%Hr%%Min%%Sec%.pdf"


O.o Thanks it worked just fine Now I'm having another problem...
I need to have the old files that were being renamed the WRONG way (with the ".pdf") back to normal. Is there any way to create a batch that simply gets all of them and removes the string ".pdf"?



Discussion

No Comment Found